source: freewrt/tools/paxmirabilis/src/cpio.1@ 7417b08

freewrt_1_0 freewrt_2_0
Last change on this file since 7417b08 was a569125, checked in by Thorsten Glaser <tg@…>, 14 years ago

even FreeWRT 1.0-stable deserves paxmirabilis-20120216 compiled with LTO ☺

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3981 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 13.8 KB
Line 
1.\" $MirOS: src/bin/pax/cpio.1,v 1.31 2012/02/16 16:01:08 tg Exp $
2.\" $OpenBSD: cpio.1,v 1.34 2011/09/03 22:59:08 jmc Exp $
3.\"
4.\" Copyright (c) 2005, 2009, 2011, 2012
5.\" Thorsten Glaser <tg@mirbsd.org>
6.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
7.\" All rights reserved.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"-
29.\" Try to make GNU groff and AT&T nroff more compatible
30.\" * ` generates ‘ in gnroff, so use \`
31.\" * ' generates ’ in gnroff, \' generates ´, so use \*(aq
32.\" * - generates ‐ in gnroff, \- generates −, so .tr it to -
33.\" thus use - for hyphens and \- for minus signs and option dashes
34.\" * ~ is size-reduced and placed atop in groff, so use \*(TI
35.\" * ^ is size-reduced and placed atop in groff, so use \*(ha
36.\" * \(en does not work in nroff, so use \*(en
37.\" The section after the "doc" macropackage has been loaded contains
38.\" additional code to convene between the UCB mdoc macropackage (and
39.\" its variant as BSD mdoc in groff) and the GNU mdoc macropackage.
40.\"
41.ie \n(.g \{\
42. if \*[.T]ascii .tr \-\N'45'
43. if \*[.T]latin1 .tr \-\N'45'
44. if \*[.T]utf8 .tr \-\N'45'
45. ds <= \[<=]
46. ds >= \[>=]
47. ds Rq \[rq]
48. ds Lq \[lq]
49. ds sL \(aq
50. ds sR \(aq
51. if \*[.T]utf8 .ds sL `
52. if \*[.T]ps .ds sL `
53. if \*[.T]utf8 .ds sR '
54. if \*[.T]ps .ds sR '
55. ds aq \(aq
56. ds TI \(ti
57. ds ha \(ha
58. ds en \(en
59.\}
60.el \{\
61. ds aq '
62. ds TI ~
63. ds ha ^
64. ds en \(em
65.\}
66.\"
67.\" Implement .Dd with the Mdocdate RCS keyword
68.\"
69.rn Dd xD
70.de Dd
71.ie \\$1$Mdocdate: \{\
72. xD \\$2 \\$3, \\$4
73.\}
74.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
75..
76.\"
77.\" .Dd must come before definition of .Mx, because when called
78.\" with -mandoc, it might implement .Mx itself, but we want to
79.\" use our own definition. And .Dd must come *first*, always.
80.\"
81.Dd $Mdocdate: February 16 2012 $
82.\"
83.\" Check which macro package we use
84.\"
85.ie \n(.g \{\
86. ie d volume-ds-1 .ds tT gnu
87. el .ds tT bsd
88.\}
89.el .ds tT ucb
90.\"
91.\" Implement .Mx (MirBSD)
92.\"
93.ie "\*(tT"gnu" \{\
94. eo
95. de Mx
96. nr curr-font \n[.f]
97. nr curr-size \n[.ps]
98. ds str-Mx \f[\n[curr-font]]\s[\n[curr-size]u]
99. ds str-Mx1 \*[Tn-font-size]\%MirOS\*[str-Mx]
100. if !\n[arg-limit] \
101. if \n[.$] \{\
102. ds macro-name Mx
103. parse-args \$@
104. \}
105. if (\n[arg-limit] > \n[arg-ptr]) \{\
106. nr arg-ptr +1
107. ie (\n[type\n[arg-ptr]] == 2) \
108. as str-Mx1 \~\*[arg\n[arg-ptr]]
109. el \
110. nr arg-ptr -1
111. \}
112. ds arg\n[arg-ptr] "\*[str-Mx1]
113. nr type\n[arg-ptr] 2
114. ds space\n[arg-ptr] "\*[space]
115. nr num-args (\n[arg-limit] - \n[arg-ptr])
116. nr arg-limit \n[arg-ptr]
117. if \n[num-args] \
118. parse-space-vector
119. print-recursive
120..
121. ec
122. ds sP \s0
123. ds tN \*[Tn-font-size]
124.\}
125.el \{\
126. de Mx
127. nr cF \\n(.f
128. nr cZ \\n(.s
129. ds aa \&\f\\n(cF\s\\n(cZ
130. if \\n(aC==0 \{\
131. ie \\n(.$==0 \&MirOS\\*(aa
132. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
133. \}
134. if \\n(aC>\\n(aP \{\
135. nr aP \\n(aP+1
136. ie \\n(C\\n(aP==2 \{\
137. as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
138. ie \\n(aC>\\n(aP \{\
139. nr aP \\n(aP+1
140. nR
141. \}
142. el .aZ
143. \}
144. el \{\
145. as b1 \&MirOS\\*(aa
146. nR
147. \}
148. \}
149..
150.\}
151.\"-
152.ie \ng==1 \{\
153. ds nc mircpio
154. ds np mirpax
155. ds nt mirtar
156. ds nm mircpio
157. Dt MIRCPIO 1
158.\}
159.el .ie \ng==2 \{\
160. ds nc paxcpio
161. ds np pax
162. ds nt paxtar
163. ds nm paxcpio
164. Dt PAXCPIO 1
165.\}
166.el \{\
167. ds nc cpio
168. ds np pax
169. ds nt tar
170. ds nm cpio
171. Dt CPIO 1
172.\}
173.\"-
174.Os MirBSD
175.Sh NAME
176.ie \ng==1 \{\
177.Nm mircpio
178.Nd copy file archives in and out
179.\}
180.el .ie \ng==2 \{\
181.Nm paxcpio
182.Nd copy file archives in and out
183.\}
184.el \{\
185.Nm cpio
186.Nd copy file archives in and out
187.\}
188.Sh SYNOPSIS
189.Nm \*(nm
190.Fl o
191.Op Fl AaBcJjLVvZz
192.Op Fl C Ar bytes
193.Op Fl F Ar archive
194.Op Fl H Ar format
195.Op Fl M Ar flag
196.Op Fl O Ar archive
197.No \*(Lt Ar name-list
198.Op \*(Gt Ar archive
199.Nm \*(nm
200.Fl i
201.Op Fl 6BbcdfJjmrSstuVvZz
202.Op Fl C Ar bytes
203.Op Fl E Ar file
204.Op Fl F Ar archive
205.Op Fl H Ar format
206.Op Fl I Ar archive
207.Op Fl M Ar flag
208.Op Ar pattern ...
209.Op \*(Lt Ar archive
210.Nm \*(nm
211.Fl p
212.Op Fl adLlmuVv
213.Ar destination-directory
214.No \*(Lt Ar name-list
215.Sh DESCRIPTION
216The
217.Nm
218command copies files to and from a
219.Nm cpio
220archive.
221.Pp
222The options are as follows:
223.Bl -tag -width Ds
224.It Fl o
225Create an archive.
226Reads the list of files to store in the
227archive from standard input, and writes the archive on standard
228output.
229.Bl -tag -width Ds
230.It Fl A
231Append to the specified archive.
232.It Fl a
233Reset the access times on files that have been copied to the
234archive.
235.It Fl B
236Set block size of output to 5120 bytes.
237.It Fl C Ar bytes
238Set the block size of output to
239.Ar bytes .
240.It Fl c
241Use ASCII format for
242.Nm cpio
243header for portability.
244.It Fl F Ar archive
245Use the specified file as the input for the archive.
246.It Fl H Ar format
247Write the archive in the specified format.
248Recognised formats are:
249.Pp
250.Bl -tag -width sv4cpio -compact
251.It Ar ar
252Unix Archiver.
253.It Ar bcpio
254Old binary
255.Nm cpio
256format.
257Selected by
258.Fl 6 .
259.It Ar cpio
260Old octal character
261.Nm cpio
262format.
263Selected by
264.Fl c .
265.It Ar sv4cpio
266SVR4 hex
267.Nm cpio
268format.
269.It Ar sv4crc
270SVR4 hex
271.Nm cpio
272format with checksums.
273This is the default format for creating new archives.
274.It Ar tar
275Old tar format.
276.It Ar ustar
277POSIX ustar format.
278.It "\ "
279.It Ar bin
280These four formats...
281.It Ar crc
282\&...are supported...
283.It Ar newc
284\&...for backwards...
285.It Ar odc
286\&...compatibility only.
287.El
288.It Fl J
289Use the xz utility to compress the archive.
290.It Fl j
291Use the bzip2 utility to compress the archive.
292.It Fl L
293Follow symbolic links.
294.It Fl M Ar flag
295Configure the archive normaliser.
296.Ar flag
297is either a numeric value compatible to
298.Xr strtonum 3
299which is directly stored in the flags word, or
300one of the following values, optionally prefixed with
301.Dq no\-
302to turn them off:
303.Pp
304.Bl -tag -width xxxxxx -compact
305.It Ar inodes
3060x0001: Serialise inodes, zero device info.
307.br
308(cpio, sv4cpio, sv4crc)
309.It Ar links
3100x0002: Store content of hard links only once.
311.br
312(cpio, sv4cpio, sv4crc)
313.It Ar mtime
3140x0004: Zero out the file modification time.
315.br
316(ar, cpio, sv4cpio, sv4crc, ustar)
317.It Ar uidgid
3180x0008: Set owner to 0:0 (root:wheel).
319.br
320(ar, cpio, sv4cpio, sv4crc, ustar)
321.It Ar verb
3220x0010: Debug this option.
323.It Ar debug
3240x0020: Debug file header storage.
325.It Ar lncp
3260x0040: Extract hard links by copy if link fails.
327.It Ar numid
3280x0080: Use only numeric uid and gid values.
329.br
330(ustar)
331.It Ar gslash
3320x0100: Append a slash after directory names.
333.br
334(ustar)
335.It Ar set
3360x0003: Keep ownership and mtime intact.
337.It Ar dist
3380x008B: Clean everything except mtime.
339.It Ar norm
3400x008F: Clean everything.
341.It Ar root
3420x0089: Clean owner and device information.
343.El
344.Pp
345This option is only implemented for the ar, cpio, sv4cpio,
346sv4crc, and ustar file format writing routines.
347.It Fl O Ar archive
348Use the specified file name as the archive to write to.
349.It Fl V
350Print a dot
351.Pq Sq .\&
352for each file written to the archive.
353.It Fl v
354Be verbose about operations.
355List filenames as they are written to the archive.
356.It Fl Z
357Use the
358.Xr compress 1
359utility to compress the archive.
360.It Fl z
361Use the
362.Xr gzip 1
363utility to compress the archive.
364.El
365.It Fl i
366Restore files from an archive.
367Reads the archive file from
368standard input and extracts files matching the
369.Ar patterns
370that were specified on the command line.
371.Bl -tag -width Ds
372.It Fl 6
373Process old-style
374.Nm cpio
375format archives.
376.It Fl B
377Set the block size of the archive being read to 5120 bytes.
378.It Fl b
379Do byte and word swapping after reading in data from the
380archive, for restoring archives created on systems with
381a different byte order.
382.It Fl C Ar bytes
383Read archive written with a block size of
384.Ar bytes .
385.It Fl c
386Expect the archive headers to be in ASCII format.
387.It Fl d
388Create any intermediate directories as needed during
389restore.
390.It Fl E Ar file
391Read list of file name patterns to extract or list from
392.Ar file .
393.It Fl F Ar archive , Fl I Ar archive
394Use the specified file as the input for the archive.
395.It Fl f
396Restore all files except those matching the
397.Ar patterns
398given on the command line.
399.It Fl H Ar format
400Read an archive of the specified format.
401Recognised formats are:
402.Pp
403.Bl -tag -width sv4cpio -compact
404.It Ar ar
405Unix Archiver.
406.It Ar bcpio
407Old binary
408.Nm cpio
409format.
410.It Ar cpio
411Old octal character
412.Nm cpio
413format.
414.It Ar sv4cpio
415SVR4 hex
416.Nm cpio
417format.
418.It Ar sv4crc
419SVR4 hex
420.Nm cpio
421format with checksums.
422.It Ar tar
423Old tar format.
424.It Ar ustar
425POSIX ustar format.
426.It "\ "
427.It Ar bin
428These four formats...
429.It Ar crc
430\&...are supported...
431.It Ar newc
432\&...for backwards...
433.It Ar odc
434\&...compatibility only.
435.El
436.It Fl J
437Use the xz utility to decompress the archive.
438.It Fl j
439Use the bzip2 utility to decompress the archive.
440.It Fl m
441Restore modification times on files.
442.It Fl r
443Rename restored files interactively.
444.It Fl S
445Swap words after reading data from the archive.
446.It Fl s
447Swap bytes after reading data from the archive.
448.It Fl t
449Only list the contents of the archive, no files or
450directories will be created.
451.It Fl u
452Overwrite files even when the file in the archive is
453older than the one that will be overwritten.
454.It Fl V
455Print a dot
456.Pq Sq .\&
457for each file read from the archive.
458.It Fl v
459Be verbose about operations.
460List filenames as they are copied in from the archive.
461.It Fl Z
462Use the
463.Xr compress 1
464utility to decompress the archive.
465.It Fl z
466Use the
467.Xr gzip 1
468utility to decompress the archive.
469.El
470.It Fl p
471Copy files from one location to another in a single pass.
472The list of files to copy are read from standard input and
473written out to a directory relative to the specified
474.Ar directory
475argument.
476.Bl -tag -width Ds
477.It Fl a
478Reset the access times on files that have been copied.
479.It Fl d
480Create any intermediate directories as needed to write
481the files at the new location.
482.It Fl L
483Follow symbolic links.
484.It Fl l
485When possible, link files rather than creating an
486extra copy.
487.It Fl m
488Restore modification times on files.
489.It Fl u
490Overwrite files even when the original file being copied is
491older than the one that will be overwritten.
492.It Fl V
493Print a dot
494.Pq Sq .\&
495for each file copied.
496.It Fl v
497Be verbose about operations.
498List filenames as they are copied.
499.El
500.El
501.Sh ENVIRONMENT
502.Bl -tag -width Fl
503.It Ev TMPDIR
504Path in which to store temporary files.
505.El
506.Sh EXIT STATUS
507The
508.Nm
509utility exits with one of the following values:
510.Pp
511.Bl -tag -width Ds -offset indent -compact
512.It 0
513All files were processed successfully.
514.It 1
515An error occurred.
516.El
517.Sh DIAGNOSTICS
518Whenever
519.Nm
520cannot create a file or a link when extracting an archive or cannot
521find a file while writing an archive, or cannot preserve the user
522ID, group ID, file mode, or access and modification times when the
523.Fl p
524option is specified, a diagnostic message is written to standard
525error and a non-zero exit value will be returned, but processing
526will continue.
527In the case where
528.Nm
529cannot create a link to a file,
530unless
531.Fl M Ar lncp
532is given,
533.Nm
534will not create a second copy of the file.
535.Pp
536If the extraction of a file from an archive is prematurely terminated
537by a signal or error,
538.Nm
539may have only partially extracted the file the user wanted.
540Additionally, the file modes of extracted files and directories may
541have incorrect file bits, and the modification and access times may
542be wrong.
543.Pp
544If the creation of an archive is prematurely terminated by a signal
545or error,
546.Nm
547may have only partially created the archive, which may violate the
548specific archive format specification.
549.Sh SEE ALSO
550.Xr ar 1 ,
551.if \ng==1 \{\
552.Xr cpio 1 ,
553.Xr deb 5 ,
554.Xr mirpax 1 ,
555.Xr mirtar 1 ,
556.\}
557.ie \ng==2 \{\
558.Xr cpio 1 ,
559.Xr deb 5 ,
560.Xr pax 1 ,
561.Xr paxtar 1 ,
562.\}
563.el \{\
564.Xr pax 1 ,
565.\}
566.Xr tar 1
567.Sh AUTHORS
568Keith Muller at the University of California, San Diego.
569.Pp
570.Mx
571extensions by
572.An Thorsten Glaser Aq tg@mirbsd.org .
573.Sh CAVEATS
574Different file formats have different maximum file sizes.
575It is recommended that a format such as cpio or ustar
576be used for larger files.
577.Bl -column "File format" "Maximum file size" -offset indent
578.It Sy "File format" Ta Sy "Maximum file size"
579.It ar Ta "10 Gigabytes \- 1 Byte"
580.It bcpio Ta "4 Gibibytes"
581.It sv4cpio Ta "4 Gibibytes"
582.It cpio Ta "8 Gibibytes"
583.It tar Ta "8 Gibibytes"
584.It ustar Ta "8 Gibibytes"
585.El
586.Pp
587The backwards-compatible format options are not available in the
588.Xr \*(np 1
589front-end.
590.Pp
591The
592.Fl M
593option is a MirBSD extension, available starting with
594.Mx 8 .
595Archives written using these options are, however, compatible to
596the standard and should be readable on any other system.
597The only option whose behaviour is not explicitly allowed by the
598standard is hard link unification (write file contens only once)
599selected by
600.Fl M Ar 0x0002 .
601.Pp
602The
603.Fl V
604option is a GNU extension, available starting with
605.Mx 11 .
606.Pp
607The
608.Ar ar
609file format matches APT repositories and the BSD
610.Xr ar 1
611specification, not GNU binutils (which can however read them) or SYSV systems.
612.Sh BUGS
613The
614.Fl s
615and
616.Fl S
617options are currently not implemented.
Note: See TracBrowser for help on using the repository browser.