]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/libarchive/libarchive/archive_write_set_options.3
MFC r316456,352732:
[FreeBSD/stable/10.git] / contrib / libarchive / libarchive / archive_write_set_options.3
1 .\" Copyright (c) 2003-2010 Tim Kientzle
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd July 27, 2019
28 .Dt ARCHIVE_WRITE_OPTIONS 3
29 .Os
30 .Sh NAME
31 .Nm archive_write_set_filter_option ,
32 .Nm archive_write_set_format_option ,
33 .Nm archive_write_set_option ,
34 .Nm archive_write_set_options
35 .Nd functions controlling options for writing archives
36 .Sh LIBRARY
37 Streaming Archive Library (libarchive, -larchive)
38 .Sh SYNOPSIS
39 .Ft int
40 .Fo archive_write_set_filter_option
41 .Fa "struct archive *"
42 .Fa "const char *module"
43 .Fa "const char *option"
44 .Fa "const char *value"
45 .Fc
46 .Ft int
47 .Fo archive_write_set_format_option
48 .Fa "struct archive *"
49 .Fa "const char *module"
50 .Fa "const char *option"
51 .Fa "const char *value"
52 .Fc
53 .Ft int
54 .Fo archive_write_set_option
55 .Fa "struct archive *"
56 .Fa "const char *module"
57 .Fa "const char *option"
58 .Fa "const char *value"
59 .Fc
60 .Ft int
61 .Fo archive_write_set_options
62 .Fa "struct archive *"
63 .Fa "const char *options"
64 .Fc
65 .Sh DESCRIPTION
66 These functions provide a way for libarchive clients to configure
67 specific write modules.
68 .Bl -tag -width indent
69 .It Xo
70 .Fn archive_write_set_filter_option ,
71 .Fn archive_write_set_format_option
72 .Xc
73 Specifies an option that will be passed to the currently-registered
74 filters (including decompression filters) or format readers.
75 .Pp
76 If
77 .Ar option
78 and
79 .Ar value
80 are both
81 .Dv NULL ,
82 these functions will do nothing and
83 .Cm ARCHIVE_OK
84 will be returned.
85 If
86 .Ar option
87 is
88 .Dv NULL
89 but
90 .Ar value
91 is not, these functions will do nothing and
92 .Cm ARCHIVE_FAILED
93 will be returned.
94 .Pp
95 If
96 .Ar module
97 is not
98 .Dv NULL ,
99 .Ar option
100 and
101 .Ar value
102 will be provided to the filter or reader named
103 .Ar module .
104 The return value will be either
105 .Cm ARCHIVE_OK
106 if the option was successfully handled or
107 .Cm ARCHIVE_WARN
108 if the option was unrecognized by the module or could otherwise
109 not be handled.
110 If there is no such module,
111 .Cm ARCHIVE_FAILED
112 will be returned.
113 .Pp
114 If
115 .Ar module
116 is
117 .Dv NULL ,
118 .Ar option
119 and
120 .Ar value
121 will be provided to every registered module.
122 If any module returns
123 .Cm ARCHIVE_FATAL ,
124 this value will be returned immediately.
125 Otherwise,
126 .Cm ARCHIVE_OK
127 will be returned if any module accepts the option, and
128 .Cm ARCHIVE_FAILED
129 in all other cases.
130 .\"
131 .It Fn archive_write_set_option
132 Calls
133 .Fn archive_write_set_format_option ,
134 then
135 .Fn archive_write_set_filter_option .
136 If either function returns
137 .Cm ARCHIVE_FATAL ,
138 .Cm ARCHIVE_FATAL
139 will be returned
140 immediately.
141 Otherwise, the greater of the two values will be returned.
142 .\"
143 .It Fn archive_write_set_options
144 .Ar options
145 is a comma-separated list of options.
146 If
147 .Ar options
148 is
149 .Dv NULL
150 or empty,
151 .Cm ARCHIVE_OK
152 will be returned immediately.
153 .Pp
154 Individual options have one of the following forms:
155 .Bl -tag -compact -width indent
156 .It Ar option=value
157 The option/value pair will be provided to every module.
158 Modules that do not accept an option with this name will ignore it.
159 .It Ar option
160 The option will be provided to every module with a value of
161 .Dq 1 .
162 .It Ar !option
163 The option will be provided to every module with a NULL value.
164 .It Ar module:option=value , Ar module:option , Ar module:!option
165 As above, but the corresponding option and value will be provided
166 only to modules whose name matches
167 .Ar module .
168 .El
169 .El
170 .\"
171 .Sh OPTIONS
172 .Bl -tag -compact -width indent
173 .It Filter gzip
174 .Bl -tag -compact -width indent
175 .It Cm compression-level
176 The value is interpreted as a decimal integer specifying the
177 gzip compression level.
178 .El
179 .It Filter xz
180 .Bl -tag -compact -width indent
181 .It Cm compression-level
182 The value is interpreted as a decimal integer specifying the
183 compression level.
184 .El
185 .It Format mtree
186 .Bl -tag -compact -width indent
187 .It Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname
188 Enable a particular keyword in the mtree output.
189 Prefix with an exclamation mark to disable the corresponding keyword.
190 The default is equivalent to
191 .Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
192 .It Cm all
193 Enables all of the above keywords.
194 .It Cm use-set
195 Enables generation of
196 .Cm /set
197 lines that specify default values for the following files and/or directories.
198 .It Cm indent
199 XXX needs explanation XXX
200 .El
201 .It Format iso9660 - volume metadata
202 These options are used to set standard ISO9660 metadata.
203 .Bl -tag -compact -width indent
204 .It Cm abstract-file Ns = Ns Ar filename
205 The file with the specified name will be identified in the ISO9660 metadata
206 as holding the abstract for this volume.
207 Default: none.
208 .It Cm application-id Ns = Ns Ar filename
209 The file with the specified name will be identified in the ISO9660 metadata
210 as holding the application identifier for this volume.
211 Default: none.
212 .It Cm biblio-file Ns = Ns Ar filename
213 The file with the specified name will be identified in the ISO9660 metadata
214 as holding the bibliography for this volume.
215 Default: none.
216 .It Cm copyright-file Ns = Ns Ar filename
217 The file with the specified name will be identified in the ISO9660 metadata
218 as holding the copyright for this volume.
219 Default: none.
220 .It Cm publisher Ns = Ns Ar filename
221 The file with the specified name will be identified in the ISO9660 metadata
222 as holding the publisher information for this volume.
223 Default: none.
224 .It Cm volume-id Ns = Ns Ar string
225 The specified string will be used as the Volume Identifier in the ISO9660 metadata.
226 It is limited to 32 bytes.
227 Default: none.
228 .El
229 .It Format iso9660 - boot support
230 These options are used to make an ISO9660 image that can be directly
231 booted on various systems.
232 .Bl -tag -compact -width indent
233 .It Cm boot Ns = Ns Ar filename
234 The file matching this name will be used as the El Torito boot image file.
235 .It Cm boot-catalog Ns = Ns Ar name
236 The name that will be used for the El Torito boot catalog.
237 Default:
238 .Ar boot.catalog
239 .It Cm boot-info-table
240 The boot image file provided by the
241 .Cm boot Ns = Ns Ar filename
242 option will be edited with appropriate boot information in bytes 8 through 64.
243 Default: disabled
244 .It Cm boot-load-seg Ns = Ns Ar hexadecimal-number
245 The load segment for a no-emulation boot image.
246 .It Cm boot-load-size Ns = Ns Ar decimal-number
247 The number of "virtual" 512-byte sectors to be loaded from a no-emulation boot image.
248 Some very old BIOSes can only load very small images, setting this
249 value to 4 will often allow such BIOSes to load the first part of
250 the boot image (which will then need to be intelligent enough to
251 load the rest of itself).
252 This should not be needed unless you are trying to support systems with very old BIOSes.
253 This defaults to the full size of the image.
254 .It Cm boot-type Ns = Ns Ar value
255 Specifies the boot semantics used by the El Torito boot image:
256 If the
257 .Ar value
258 is
259 .Cm fd ,
260 then the boot image is assumed to be a bootable floppy image.
261 If the
262 .Ar value
263 is
264 .Cm hd ,
265 then the boot image is assumed to be a bootable hard disk image.
266 If the
267 .Ar value
268 is
269 .Cm no-emulation ,
270 the boot image is used without floppy or hard disk emulation.
271 If the boot image is exactly 1.2MB, 1.44MB, or 2.88MB, then
272 the default is
273 .Cm fd ,
274 otherwise the default is
275 .Cm no-emulation .
276 .El
277 .It Format iso9660 - filename and size extensions
278 Various extensions to the base ISO9660 format.
279 .Bl -tag -compact -width indent
280 .It Cm allow-ldots
281 If enabled, allows filenames to begin with a leading period.
282 If disabled, filenames that begin with a leading period will have
283 that period replaced by an underscore character in the standard ISO9660
284 namespace.
285 This does not impact names stored in the Rockridge or Joliet extension area.
286 Default: disabled.
287 .It Cm allow-lowercase
288 If enabled, allows filenames to contain lowercase characters.
289 If disabled, filenames will be forced to uppercase.
290 This does not impact names stored in the Rockridge or Joliet extension area.
291 Default: disabled.
292 .It Cm allow-multidot
293 If enabled, allows filenames to contain multiple period characters, in violation of the ISO9660 specification.
294 If disabled, additional periods will be converted to underscore characters.
295 This does not impact names stored in the Rockridge or Joliet extension area.
296 Default: disabled.
297 .It Cm allow-period
298 If enabled, allows filenames to contain trailing period characters, in violation of the ISO9660 specification.
299 If disabled, trailing periods will be converted to underscore characters.
300 This does not impact names stored in the Rockridge or Joliet extension area.
301 Default: disabled.
302 .It Cm allow-pvd-lowercase
303 If enabled, the Primary Volume Descriptor may contain lowercase ASCII characters, in violation of the ISO9660 specification.
304 If disabled, characters will be converted to uppercase ASCII.
305 Default: disabled.
306 .It Cm allow-sharp-tilde
307 If enabled, sharp and tilde characters will be permitted in filenames, in violation if the ISO9660 specification.
308 If disabled, such characters will be converted to underscore characters.
309 Default: disabled.
310 .It Cm allow-vernum
311 If enabled, version numbers will be included with files.
312 If disabled, version numbers will be suppressed, in violation of the ISO9660 standard.
313 This does not impact names stored in the Rockridge or Joliet extension area.
314 Default: enabled.
315 .It Cm iso-level
316 This enables support for file size and file name extensions in the
317 core ISO9660 area.
318 The name extensions specified here do not affect the names stored in the Rockridge or Joliet extension areas.
319 .Bl -tag -compact -width indent
320 .It Cm iso-level=1
321 The most compliant form of ISO9660 image.
322 Filenames are limited to 8.3 uppercase format,
323 directory names are limited to 8 uppercase characters,
324 files are limited to 4 GiB,
325 the complete ISO9660 image cannot exceed 4 GiB.
326 .It Cm iso-level=2
327 Filenames are limited to 30 uppercase characters with a 30-character extension,
328 directory names are limited to 30 characters,
329 files are limited to 4 GiB.
330 .It Cm iso-level=3
331 As with
332 .Cm iso-level=2 ,
333 except that files may exceed 4 GiB.
334 .It Cm iso-level=4
335 As with
336 .Cm iso-level=3 ,
337 except that filenames may be up to 193 characters
338 and may include arbitrary 8-bit characters.
339 .El
340 .It Cm joliet
341 Microsoft's Joliet extensions store a completely separate set of directory information about each file.
342 In particular, this information includes Unicode filenames of up to 255 characters.
343 Default: enabled.
344 .It Cm limit-depth
345 If enabled, libarchive will use directory relocation records to ensure that
346 no pathname exceeds the ISO9660 limit of 8 directory levels.
347 If disabled, no relocation will occur.
348 Default: enabled.
349 .It Cm limit-dirs
350 If enabled, libarchive will cause an error if there are more than
351 65536 directories.
352 If disabled, there is no limit on the number of directories.
353 Default: enabled
354 .It Cm pad
355 If enabled, 300 kiB of zero bytes will be appended to the end of the archive.
356 Default: enabled
357 .It Cm relaxed-filenames
358 If enabled, all 7-bit ASCII characters are permitted in filenames
359 (except lowercase characters unless
360 .Cm allow-lowercase
361 is also specified).
362 This violates ISO9660 standards.
363 This does not impact names stored in the Rockridge or Joliet extension area.
364 Default: disabled.
365 .It Cm rockridge
366 The Rockridge extensions store an additional set of POSIX-style file
367 information with each file, including mtime, atime, ctime, permissions,
368 and long filenames with arbitrary 8-bit characters.
369 These extensions also support symbolic links and other POSIX file types.
370 Default: enabled.
371 .El
372 .It Format iso9660 - zisofs support
373 The zisofs extensions permit each file to be independently compressed
374 using a gzip-compatible compression.
375 This can provide significant size savings, but requires the reading
376 system to have support for these extensions.
377 These extensions are disabled by default.
378 .Bl -tag -compact -width indent
379 .It Cm compression-level Ns = Ns number
380 The compression level used by the deflate compressor.
381 Ranges from 0 (least effort) to 9 (most effort).
382 Default: 6
383 .It Cm zisofs
384 Synonym for
385 .Cm zisofs=direct .
386 .It Cm zisofs=direct
387 Compress each file in the archive.
388 Unlike
389 .Cm zisofs=indirect ,
390 this is handled entirely within libarchive and does not require a
391 separate utility.
392 For best results, libarchive tests each file and will store
393 the file uncompressed if the compression does not actually save any space.
394 In particular, files under 2k will never be compressed.
395 Note that boot image files are never compressed.
396 .It Cm zisofs=indirect
397 Recognizes files that have already been compressed with the
398 .Cm mkzftree
399 utility and sets up the necessary file metadata so that
400 readers will correctly identify these as zisofs-compressed files.
401 .It Cm zisofs-exclude Ns = Ns Ar filename
402 Specifies a filename that should not be compressed when using
403 .Cm zisofs=direct .
404 This option can be provided multiple times to suppress compression
405 on many files.
406 .El
407 .It Format 7zip
408 .Bl -tag -compact -width indent
409 .It Cm compression
410 The value is one of
411 .Dq store ,
412 .Dq deflate ,
413 .Dq bzip2 ,
414 .Dq lzma1 ,
415 .Dq lzma2
416 or
417 .Dq ppmd
418 to indicate how the following entries should be compressed.
419 Note that this setting is ignored for directories, symbolic links,
420 and other special entries.
421 .It Cm compression-level
422 The value is interpreted as a decimal integer specifying the
423 compression level.
424 Values between 0 and 9 are supported.
425 The interpretation of the compression level depends on the chosen
426 compression method.
427 .El
428 .It Format zip
429 .Bl -tag -compact -width indent
430 .It Cm compression
431 The value is either
432 .Dq store
433 or
434 .Dq deflate
435 to indicate how the following entries should be compressed.
436 Note that this setting is ignored for directories, symbolic links,
437 and other special entries.
438 .It Cm compression-level
439 The value is interpreted as a decimal integer specifying the
440 compression level.
441 Values between 0 and 9 are supported.
442 A compression level of 0 switches the compression method to
443 .Dq store ,
444 other values will enable
445 .Dq deflate
446 compression with the given level.
447 .It Cm experimental
448 This boolean option enables or disables experimental Zip features
449 that may not be compatible with other Zip implementations.
450 .It Cm fakecrc32
451 This boolean option disables CRC calculations.
452 All CRC fields are set to zero.
453 It should not be used except for testing purposes.
454 .It Cm hdrcharset
455 This sets the character set used for filenames.
456 .It Cm zip64
457 Zip64 extensions provide additional file size information
458 for entries larger than 4 GiB.
459 They also provide extended file offset and archive size information
460 when archives exceed 4 GiB.
461 By default, the Zip writer selectively enables these extensions only as needed.
462 In particular, if the file size is unknown, the Zip writer will
463 include Zip64 extensions to guard against the possibility that the
464 file might be larger than 4 GiB.
465 .Pp
466 Setting this boolean option will force the writer to use Zip64 extensions
467 even for small files that would not otherwise require them.
468 This is primarily useful for testing.
469 .Pp
470 Disabling this option with
471 .Cm !zip64
472 will force the Zip writer to avoid Zip64 extensions:
473 It will reject files with size greater than 4 GiB,
474 it will reject any new entries once the total archive size reaches 4 GiB,
475 and it will not use Zip64 extensions for files with unknown size.
476 In particular, this can improve compatibility when generating archives
477 where the entry sizes are not known in advance.
478 .El
479 .El
480 .Sh EXAMPLES
481 The following example creates an archive write handle to
482 create a gzip-compressed ISO9660 format image.
483 The two options here specify that the ISO9660 archive will use
484 .Ar kernel.img
485 as the boot image for El Torito booting, and that the gzip
486 compressor should use the maximum compression level.
487 .Bd -literal -offset indent
488 a = archive_write_new();
489 archive_write_add_filter_gzip(a);
490 archive_write_set_format_iso9660(a);
491 archive_write_set_options(a, "boot=kernel.img,compression=9");
492 archive_write_open_filename(a, filename, blocksize);
493 .Ed
494 .\"
495 .Sh ERRORS
496 More detailed error codes and textual descriptions are available from the
497 .Fn archive_errno
498 and
499 .Fn archive_error_string
500 functions.
501 .\"
502 .Sh SEE ALSO
503 .Xr tar 1 ,
504 .Xr archive_read_set_options 3 ,
505 .Xr archive_write 3 ,
506 .Xr libarchive 3
507 .Sh HISTORY
508 The
509 .Nm libarchive
510 library first appeared in
511 .Fx 5.3 .
512 .Sh AUTHORS
513 .An -nosplit
514 The options support for libarchive was originally implemented by
515 .An Michihiro NAKAJIMA .
516 .Sh BUGS