| 1 |
.\" $MirOS: src/bin/pax/cpio.1,v 1.17 2008/03/14 17:05:06 tg Exp $ |
| 2 |
.\" $OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $ |
| 3 |
.\" |
| 4 |
.\" Copyright (c) 2005 Thorsten Glaser <tg@66h.42h.de> |
| 5 |
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert |
| 6 |
.\" All rights reserved. |
| 7 |
.\" |
| 8 |
.\" Redistribution and use in source and binary forms, with or without |
| 9 |
.\" modification, are permitted provided that the following conditions |
| 10 |
.\" are met: |
| 11 |
.\" 1. Redistributions of source code must retain the above copyright |
| 12 |
.\" notice, this list of conditions and the following disclaimer. |
| 13 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
| 14 |
.\" notice, this list of conditions and the following disclaimer in the |
| 15 |
.\" documentation and/or other materials provided with the distribution. |
| 16 |
.\" |
| 17 |
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 18 |
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 19 |
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 20 |
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 21 |
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 22 |
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 |
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 |
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 |
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 |
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
.\" |
| 28 |
.\" $OpenBSD: cpio.1,v 1.26 2007/05/31 19:19:15 jmc Exp $ |
| 29 |
.\" |
| 30 |
.\"- |
| 31 |
.\" Try to make GNU groff and AT&T nroff more compatible |
| 32 |
.\" * ` generates ‘ in groff, so use \` |
| 33 |
.\" * ' generates ’ in groff, \' generates ´, so use \*(aq |
| 34 |
.\" * - generates ‐ in groff, \- generates −, fixed in tmac/mdoc/doc-groff |
| 35 |
.\" thus use - for hyphens and \- for minus signs and option dashes |
| 36 |
.\" * ~ is size-reduced and placed atop in groff, so use \*(TI |
| 37 |
.\" * ^ is size-reduced and placed atop in groff, so use \*(ha |
| 38 |
.\" * \(en does not work in nroff, so use \*(en |
| 39 |
.ie \n(.g \{\ |
| 40 |
. ds aq \(aq |
| 41 |
. ds TI \(ti |
| 42 |
. ds ha \(ha |
| 43 |
. ds en \(en |
| 44 |
.\} |
| 45 |
.el \{\ |
| 46 |
. ds aq ' |
| 47 |
. ds TI ~ |
| 48 |
. ds ha ^ |
| 49 |
. ds en \(em |
| 50 |
.\} |
| 51 |
.\" |
| 52 |
.\" Implement .Dd with the Mdocdate RCS keyword |
| 53 |
.rn Dd xD |
| 54 |
.de Dd |
| 55 |
.ie \\$1$Mdocdate: \{\ |
| 56 |
. xD \\$2 \\$3, \\$4 |
| 57 |
.\} |
| 58 |
.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 |
| 59 |
.. |
| 60 |
.\" |
| 61 |
.\" .Dd must come before definition of .Mx, because when called |
| 62 |
.\" with -mandoc, it might implement .Mx itself, but we want to |
| 63 |
.\" use our own definition. And .Dd must come *first*, always. |
| 64 |
.Dd $Mdocdate: March 14 2008 $ |
| 65 |
.\" |
| 66 |
.\" Implement .Mx (MirBSD) |
| 67 |
.de Mx |
| 68 |
.nr cF \\n(.f |
| 69 |
.nr cZ \\n(.s |
| 70 |
.ds aa \&\f\\n(cF\s\\n(cZ |
| 71 |
.if \\n(aC==0 \{\ |
| 72 |
. ie \\n(.$==0 \&MirOS\\*(aa |
| 73 |
. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 |
| 74 |
.\} |
| 75 |
.if \\n(aC>\\n(aP \{\ |
| 76 |
. nr aP \\n(aP+1 |
| 77 |
. ie \\n(C\\n(aP==2 \{\ |
| 78 |
. as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa |
| 79 |
. ie \\n(aC>\\n(aP \{\ |
| 80 |
. nr aP \\n(aP+1 |
| 81 |
. nR |
| 82 |
. \} |
| 83 |
. el .aZ |
| 84 |
. \} |
| 85 |
. el \{\ |
| 86 |
. as b1 \&MirOS\\*(aa |
| 87 |
. nR |
| 88 |
. \} |
| 89 |
.\} |
| 90 |
.. |
| 91 |
.Dt CPIO 1 |
| 92 |
.Os MirBSD |
| 93 |
.Sh NAME |
| 94 |
.Nm cpio |
| 95 |
.Nd copy file archives in and out |
| 96 |
.Sh SYNOPSIS |
| 97 |
.Nm cpio |
| 98 |
.Fl o |
| 99 |
.Op Fl AaBcLvZz |
| 100 |
.Op Fl C Ar bytes |
| 101 |
.Op Fl F Ar archive |
| 102 |
.Op Fl H Ar format |
| 103 |
.Op Fl M Ar flag |
| 104 |
.Op Fl O Ar archive |
| 105 |
.Ar \*(Lt name-list |
| 106 |
.Op Ar \*(Gt archive |
| 107 |
.Nm cpio |
| 108 |
.Fl i |
| 109 |
.Op Fl 6BbcdfmrSstuvZz |
| 110 |
.Op Fl C Ar bytes |
| 111 |
.Op Fl E Ar file |
| 112 |
.Op Fl F Ar archive |
| 113 |
.Op Fl H Ar format |
| 114 |
.Op Fl I Ar archive |
| 115 |
.Op Ar pattern ... |
| 116 |
.Op Ar \*(Lt archive |
| 117 |
.Nm cpio |
| 118 |
.Fl p |
| 119 |
.Op Fl adLlmuv |
| 120 |
.Ar destination-directory |
| 121 |
.Ar \*(Lt name-list |
| 122 |
.Sh DESCRIPTION |
| 123 |
The |
| 124 |
.Nm |
| 125 |
command copies files to and from a |
| 126 |
.Nm |
| 127 |
archive. |
| 128 |
.Pp |
| 129 |
The options are as follows: |
| 130 |
.Bl -tag -width Ds |
| 131 |
.It Fl o |
| 132 |
Create an archive. |
| 133 |
Reads the list of files to store in the |
| 134 |
archive from standard input, and writes the archive on standard |
| 135 |
output. |
| 136 |
.Bl -tag -width Ds |
| 137 |
.It Fl A |
| 138 |
Append to the specified archive. |
| 139 |
.It Fl a |
| 140 |
Reset the access times on files that have been copied to the |
| 141 |
archive. |
| 142 |
.It Fl B |
| 143 |
Set block size of output to 5120 bytes. |
| 144 |
.It Fl C Ar bytes |
| 145 |
Set the block size of output to |
| 146 |
.Ar bytes . |
| 147 |
.It Fl c |
| 148 |
Use ASCII format for |
| 149 |
.Nm |
| 150 |
header for portability. |
| 151 |
.It Fl F Ar archive |
| 152 |
Use the specified file as the input for the archive. |
| 153 |
.It Fl H Ar format |
| 154 |
Write the archive in the specified format. |
| 155 |
Recognised formats are: |
| 156 |
.Pp |
| 157 |
.Bl -tag -width sv4cpio -compact |
| 158 |
.It Ar bcpio |
| 159 |
Old binary |
| 160 |
.Nm |
| 161 |
format. |
| 162 |
Selected by |
| 163 |
.Fl 6 . |
| 164 |
.It Ar cpio |
| 165 |
Old octal character |
| 166 |
.Nm |
| 167 |
format. |
| 168 |
Selected by |
| 169 |
.Fl c . |
| 170 |
.It Ar sv4cpio |
| 171 |
SVR4 hex |
| 172 |
.Nm |
| 173 |
format. |
| 174 |
.It Ar sv4crc |
| 175 |
SVR4 hex |
| 176 |
.Nm |
| 177 |
format with checksums. |
| 178 |
This is the default format for creating new archives. |
| 179 |
.It Ar tar |
| 180 |
Old tar format. |
| 181 |
.It Ar ustar |
| 182 |
POSIX ustar format. |
| 183 |
.It "\ " |
| 184 |
.It Ar bin |
| 185 |
These |
| 186 |
.It Ar crc |
| 187 |
four |
| 188 |
.It Ar newc |
| 189 |
formats |
| 190 |
.It Ar odc |
| 191 |
are supported for backwards compatibility only. |
| 192 |
.El |
| 193 |
.It Fl L |
| 194 |
Follow symbolic links. |
| 195 |
.It Fl M Ar flag |
| 196 |
Configure the archive normaliser. |
| 197 |
.Ar flag |
| 198 |
is either a numeric value compatible to |
| 199 |
.Xr strtonum 3 |
| 200 |
which is directly stored in the flags word, or |
| 201 |
one of the following values, prefixed with |
| 202 |
.Dq no- |
| 203 |
to turn them off, or not, to turn them on: |
| 204 |
.Pp |
| 205 |
.Bl -tag -width xxxxxx -compact |
| 206 |
.It Ar inodes |
| 207 |
0x0001: Serialise inodes, zero device info. |
| 208 |
.It Ar links |
| 209 |
0x0002: Store content of hard links only once. |
| 210 |
.It Ar mtime |
| 211 |
0x0004: Zero out the file modification time. |
| 212 |
.It Ar uidgid |
| 213 |
0x0008: Set owner to 0:0 (root:wheel). |
| 214 |
.It Ar dist |
| 215 |
0x000B: Clean everything except mtime. |
| 216 |
.It Ar set |
| 217 |
0x0003: Keep ownership and mtime intact. |
| 218 |
.It Ar norm |
| 219 |
0x000F: Clean everything. |
| 220 |
.It Ar root |
| 221 |
0x0009: Clean owner and device information. |
| 222 |
.It Ar verb |
| 223 |
0x0010: Debug this option. |
| 224 |
.It Ar debug |
| 225 |
0x0020: Debug file header storage. |
| 226 |
.El |
| 227 |
.Pp |
| 228 |
This option is only implemented for the cpio, sv4cpio, |
| 229 |
sv4crc, and ustar file format writing routines. |
| 230 |
For the ustar format, the |
| 231 |
.Ar inodes |
| 232 |
and |
| 233 |
.Ar links |
| 234 |
specifiers are ignored. |
| 235 |
.It Fl O Ar archive |
| 236 |
Use the specified file name as the archive to write to. |
| 237 |
.It Fl v |
| 238 |
Be verbose about operations. |
| 239 |
List filenames as they are written to the archive. |
| 240 |
.It Fl Z |
| 241 |
Compress archive using |
| 242 |
.Xr compress 1 |
| 243 |
format. |
| 244 |
.It Fl z |
| 245 |
Compress archive using |
| 246 |
.Xr gzip 1 |
| 247 |
format. |
| 248 |
.El |
| 249 |
.It Fl i |
| 250 |
Restore files from an archive. |
| 251 |
Reads the archive file from |
| 252 |
standard input and extracts files matching the |
| 253 |
.Ar patterns |
| 254 |
that were specified on the command line. |
| 255 |
.Bl -tag -width Ds |
| 256 |
.It Fl 6 |
| 257 |
Process old-style |
| 258 |
.Nm |
| 259 |
format archives. |
| 260 |
.It Fl B |
| 261 |
Set the block size of the archive being read to 5120 bytes. |
| 262 |
.It Fl b |
| 263 |
Do byte and word swapping after reading in data from the |
| 264 |
archive, for restoring archives created on systems with |
| 265 |
a different byte order. |
| 266 |
.It Fl C Ar bytes |
| 267 |
Read archive written with a block size of |
| 268 |
.Ar bytes . |
| 269 |
.It Fl c |
| 270 |
Expect the archive headers to be in ASCII format. |
| 271 |
.It Fl d |
| 272 |
Create any intermediate directories as needed during |
| 273 |
restore. |
| 274 |
.It Fl E Ar file |
| 275 |
Read list of file name patterns to extract or list from |
| 276 |
.Ar file . |
| 277 |
.It Fl F Ar archive , Fl I Ar archive |
| 278 |
Use the specified file as the input for the archive. |
| 279 |
.It Fl f |
| 280 |
Restore all files except those matching the |
| 281 |
.Ar patterns |
| 282 |
given on the command line. |
| 283 |
.It Fl H Ar format |
| 284 |
Read an archive of the specified format. |
| 285 |
Recognised formats are: |
| 286 |
.Pp |
| 287 |
.Bl -tag -width sv4cpio -compact |
| 288 |
.It Ar bcpio |
| 289 |
Old binary |
| 290 |
.Nm |
| 291 |
format. |
| 292 |
.It Ar cpio |
| 293 |
Old octal character |
| 294 |
.Nm |
| 295 |
format. |
| 296 |
.It Ar sv4cpio |
| 297 |
SVR4 hex |
| 298 |
.Nm |
| 299 |
format. |
| 300 |
.It Ar sv4crc |
| 301 |
SVR4 hex |
| 302 |
.Nm |
| 303 |
format with checksums. |
| 304 |
.It Ar tar |
| 305 |
Old tar format. |
| 306 |
.It Ar ustar |
| 307 |
POSIX ustar format. |
| 308 |
.It "\ " |
| 309 |
.It Ar bin |
| 310 |
These |
| 311 |
.It Ar crc |
| 312 |
four |
| 313 |
.It Ar newc |
| 314 |
formats |
| 315 |
.It Ar odc |
| 316 |
are supported for backwards compatibility only. |
| 317 |
.El |
| 318 |
.It Fl m |
| 319 |
Restore modification times on files. |
| 320 |
.It Fl r |
| 321 |
Rename restored files interactively. |
| 322 |
.It Fl S |
| 323 |
Swap words after reading data from the archive. |
| 324 |
.It Fl s |
| 325 |
Swap bytes after reading data from the archive. |
| 326 |
.It Fl t |
| 327 |
Only list the contents of the archive, no files or |
| 328 |
directories will be created. |
| 329 |
.It Fl u |
| 330 |
Overwrite files even when the file in the archive is |
| 331 |
older than the one that will be overwritten. |
| 332 |
.It Fl v |
| 333 |
Be verbose about operations. |
| 334 |
List filenames as they are copied in from the archive. |
| 335 |
.It Fl Z |
| 336 |
Uncompress archive using |
| 337 |
.Xr compress 1 |
| 338 |
format. |
| 339 |
.It Fl z |
| 340 |
Uncompress archive using |
| 341 |
.Xr gzip 1 |
| 342 |
format. |
| 343 |
.El |
| 344 |
.It Fl p |
| 345 |
Copy files from one location to another in a single pass. |
| 346 |
The list of files to copy are read from standard input and |
| 347 |
written out to a directory relative to the specified |
| 348 |
.Ar directory |
| 349 |
argument. |
| 350 |
.Bl -tag -width Ds |
| 351 |
.It Fl a |
| 352 |
Reset the access times on files that have been copied. |
| 353 |
.It Fl d |
| 354 |
Create any intermediate directories as needed to write |
| 355 |
the files at the new location. |
| 356 |
.It Fl L |
| 357 |
Follow symbolic links. |
| 358 |
.It Fl l |
| 359 |
When possible, link files rather than creating an |
| 360 |
extra copy. |
| 361 |
.It Fl m |
| 362 |
Restore modification times on files. |
| 363 |
.It Fl u |
| 364 |
Overwrite files even when the original file being copied is |
| 365 |
older than the one that will be overwritten. |
| 366 |
.It Fl v |
| 367 |
Be verbose about operations. |
| 368 |
List filenames as they are copied. |
| 369 |
.El |
| 370 |
.El |
| 371 |
.Sh ENVIRONMENT |
| 372 |
.Bl -tag -width Fl |
| 373 |
.It Ev TMPDIR |
| 374 |
Path in which to store temporary files. |
| 375 |
.El |
| 376 |
.Sh ERRORS |
| 377 |
.Nm |
| 378 |
will exit with one of the following values: |
| 379 |
.Bl -tag -width 2n |
| 380 |
.It 0 |
| 381 |
All files were processed successfully. |
| 382 |
.It 1 |
| 383 |
An error occurred. |
| 384 |
.El |
| 385 |
.Pp |
| 386 |
Whenever |
| 387 |
.Nm |
| 388 |
cannot create a file or a link when extracting an archive or cannot |
| 389 |
find a file while writing an archive, or cannot preserve the user |
| 390 |
ID, group ID, file mode, or access and modification times when the |
| 391 |
.Fl p |
| 392 |
option is specified, a diagnostic message is written to standard |
| 393 |
error and a non-zero exit value will be returned, but processing |
| 394 |
will continue. |
| 395 |
In the case where |
| 396 |
.Nm |
| 397 |
cannot create a link to a file, |
| 398 |
.Nm |
| 399 |
will not create a second copy of the file. |
| 400 |
.Pp |
| 401 |
If the extraction of a file from an archive is prematurely terminated |
| 402 |
by a signal or error, |
| 403 |
.Nm |
| 404 |
may have only partially extracted the file the user wanted. |
| 405 |
Additionally, the file modes of extracted files and directories may |
| 406 |
have incorrect file bits, and the modification and access times may |
| 407 |
be wrong. |
| 408 |
.Pp |
| 409 |
If the creation of an archive is prematurely terminated by a signal |
| 410 |
or error, |
| 411 |
.Nm |
| 412 |
may have only partially created the archive, which may violate the |
| 413 |
specific archive format specification. |
| 414 |
.Sh SEE ALSO |
| 415 |
.Xr pax 1 , |
| 416 |
.Xr tar 1 |
| 417 |
.Sh AUTHORS |
| 418 |
Keith Muller at the University of California, San Diego. |
| 419 |
.Sh CAVEATS |
| 420 |
Different file formats have different maximum file sizes. |
| 421 |
It is recommended that a format such as cpio or ustar |
| 422 |
be used for larger files. |
| 423 |
.Pp |
| 424 |
.Bl -column "File format" "Maximum file size" -offset indent -compact |
| 425 |
.It Sy "File format" Ta Sy "Maximum file size" |
| 426 |
.It bcpio Ta 4 Gibibytes |
| 427 |
.It sv4cpio Ta 4 Gibibytes |
| 428 |
.It cpio Ta 8 Gibibytes |
| 429 |
.It tar Ta 8 Gibibytes |
| 430 |
.It ustar Ta 8 Gibibytes |
| 431 |
.El |
| 432 |
.Sh BUGS |
| 433 |
The |
| 434 |
.Fl s |
| 435 |
and |
| 436 |
.Fl S |
| 437 |
options are currently not implemented. |
| 438 |
.Sh CAVEATS |
| 439 |
The backwards-compatible format options are not available in the |
| 440 |
.Xr pax 1 |
| 441 |
front-end. |
| 442 |
.Pp |
| 443 |
The |
| 444 |
.Fl M |
| 445 |
option is a MirBSD extensions, available starting with |
| 446 |
.Mx 8 . |
| 447 |
Archives written using these options are, however, compatible to |
| 448 |
the standard and should be readable on any other system. |
| 449 |
The only option whose behaviour is not explicitly allowed by the |
| 450 |
standard is hard link unification (write file contens only once) |
| 451 |
selected by |
| 452 |
.Fl M Ar 0x0002 . |