Implement pax -O option to permit limiting a PAX archive to a single volume.
-O Force the archive to be one volume. If a volume ends prematurely, pax will not prompt for a new volume. PR: 198481 Submitted by: Sevan Janiyan Reviewed by: allanjude (doc)
This commit is contained in:
parent
a1edda90b2
commit
d6e1f8d70c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280206
@ -1123,7 +1123,7 @@ ar_next(void)
|
|||||||
if (sigprocmask(SIG_SETMASK, &o_mask, NULL) < 0)
|
if (sigprocmask(SIG_SETMASK, &o_mask, NULL) < 0)
|
||||||
syswarn(0, errno, "Unable to restore signal mask");
|
syswarn(0, errno, "Unable to restore signal mask");
|
||||||
|
|
||||||
if (done || !wr_trail || strcmp(NM_TAR, argv0) == 0)
|
if (done || !wr_trail || Oflag || strcmp(NM_TAR, argv0) == 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
tty_prnt("\nATTENTION! %s archive volume change required.\n", argv0);
|
tty_prnt("\nATTENTION! %s archive volume change required.\n", argv0);
|
||||||
|
@ -217,6 +217,7 @@ extern int vflag;
|
|||||||
extern int Dflag;
|
extern int Dflag;
|
||||||
extern int Hflag;
|
extern int Hflag;
|
||||||
extern int Lflag;
|
extern int Lflag;
|
||||||
|
extern int Oflag;
|
||||||
extern int Xflag;
|
extern int Xflag;
|
||||||
extern int Yflag;
|
extern int Yflag;
|
||||||
extern int Zflag;
|
extern int Zflag;
|
||||||
|
@ -194,7 +194,7 @@ pax_options(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* process option flags
|
* process option flags
|
||||||
*/
|
*/
|
||||||
while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
|
while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLOPT:U:XYZ"))
|
||||||
!= -1) {
|
!= -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
@ -447,6 +447,12 @@ pax_options(int argc, char **argv)
|
|||||||
Lflag = 1;
|
Lflag = 1;
|
||||||
flg |= CLF;
|
flg |= CLF;
|
||||||
break;
|
break;
|
||||||
|
case 'O':
|
||||||
|
/*
|
||||||
|
* Force one volume. Non standard option.
|
||||||
|
*/
|
||||||
|
Oflag = 1;
|
||||||
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/*
|
/*
|
||||||
* do NOT follow symlinks (default)
|
* do NOT follow symlinks (default)
|
||||||
@ -584,7 +590,7 @@ tar_options(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int fstdin = 0;
|
int fstdin = 0;
|
||||||
int Oflag = 0;
|
int tar_Oflag = 0;
|
||||||
int nincfiles = 0;
|
int nincfiles = 0;
|
||||||
int incfiles_max = 0;
|
int incfiles_max = 0;
|
||||||
struct incfile {
|
struct incfile {
|
||||||
@ -664,7 +670,7 @@ tar_options(int argc, char **argv)
|
|||||||
if (opt_add("write_opt=nodir") < 0)
|
if (opt_add("write_opt=nodir") < 0)
|
||||||
tar_usage();
|
tar_usage();
|
||||||
case 'O':
|
case 'O':
|
||||||
Oflag = 1;
|
tar_Oflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
/*
|
/*
|
||||||
@ -820,8 +826,8 @@ tar_options(int argc, char **argv)
|
|||||||
* (unless -o specified)
|
* (unless -o specified)
|
||||||
*/
|
*/
|
||||||
if (act == ARCHIVE || act == APPND)
|
if (act == ARCHIVE || act == APPND)
|
||||||
frmt = &(fsub[Oflag ? F_OTAR : F_TAR]);
|
frmt = &(fsub[tar_Oflag ? F_OTAR : F_TAR]);
|
||||||
else if (Oflag) {
|
else if (tar_Oflag) {
|
||||||
paxwarn(1, "The -O/-o options are only valid when writing an archive");
|
paxwarn(1, "The -O/-o options are only valid when writing an archive");
|
||||||
tar_usage(); /* only valid when writing */
|
tar_usage(); /* only valid when writing */
|
||||||
}
|
}
|
||||||
@ -1526,25 +1532,25 @@ no_op(void)
|
|||||||
void
|
void
|
||||||
pax_usage(void)
|
pax_usage(void)
|
||||||
{
|
{
|
||||||
(void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr);
|
(void)fputs("usage: pax [-cdnOvz] [-E limit] [-f archive] ", stderr);
|
||||||
(void)fputs("[-s replstr] ... [-U user] ...", stderr);
|
(void)fputs("[-s replstr] ... [-U user] ...", stderr);
|
||||||
(void)fputs("\n [-G group] ... ", stderr);
|
(void)fputs("\n [-G group] ... ", stderr);
|
||||||
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
|
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
|
||||||
(void)fputs("[pattern ...]\n", stderr);
|
(void)fputs("[pattern ...]\n", stderr);
|
||||||
(void)fputs(" pax -r [-cdiknuvzDYZ] [-E limit] ", stderr);
|
(void)fputs(" pax -r [-cdiknOuvzDYZ] [-E limit] ", stderr);
|
||||||
(void)fputs("[-f archive] [-o options] ... \n", stderr);
|
(void)fputs("[-f archive] [-o options] ... \n", stderr);
|
||||||
(void)fputs(" [-p string] ... [-s replstr] ... ", stderr);
|
(void)fputs(" [-p string] ... [-s replstr] ... ", stderr);
|
||||||
(void)fputs("[-U user] ... [-G group] ...\n ", stderr);
|
(void)fputs("[-U user] ... [-G group] ...\n ", stderr);
|
||||||
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
|
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
|
||||||
(void)fputs(" [pattern ...]\n", stderr);
|
(void)fputs(" [pattern ...]\n", stderr);
|
||||||
(void)fputs(" pax -w [-dituvzHLPX] [-b blocksize] ", stderr);
|
(void)fputs(" pax -w [-dituvzHLOPX] [-b blocksize] ", stderr);
|
||||||
(void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
|
(void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
|
||||||
(void)fputs(" [-B bytes] [-s replstr] ... ", stderr);
|
(void)fputs(" [-B bytes] [-s replstr] ... ", stderr);
|
||||||
(void)fputs("[-o options] ... [-U user] ...", stderr);
|
(void)fputs("[-o options] ... [-U user] ...", stderr);
|
||||||
(void)fputs("\n [-G group] ... ", stderr);
|
(void)fputs("\n [-G group] ... ", stderr);
|
||||||
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
|
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
|
||||||
(void)fputs("[file ...]\n", stderr);
|
(void)fputs("[file ...]\n", stderr);
|
||||||
(void)fputs(" pax -r -w [-diklntuvDHLPXYZ] ", stderr);
|
(void)fputs(" pax -r -w [-diklntuvDHLOPXYZ] ", stderr);
|
||||||
(void)fputs("[-p string] ... [-s replstr] ...", stderr);
|
(void)fputs("[-p string] ... [-s replstr] ...", stderr);
|
||||||
(void)fputs("\n [-U user] ... [-G group] ... ", stderr);
|
(void)fputs("\n [-U user] ... [-G group] ... ", stderr);
|
||||||
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
|
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
|
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd December 21, 2013
|
.Dd March 17, 2015
|
||||||
.Dt PAX 1
|
.Dt PAX 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -41,7 +41,7 @@
|
|||||||
.Nd read and write file archives and copy directory hierarchies
|
.Nd read and write file archives and copy directory hierarchies
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl cdnvz
|
.Op Fl cdnvzO
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl f Ar archive
|
.Op Fl f Ar archive
|
||||||
.Ek
|
.Ek
|
||||||
@ -68,7 +68,7 @@
|
|||||||
.Op Ar pattern ...\&
|
.Op Ar pattern ...\&
|
||||||
.Nm
|
.Nm
|
||||||
.Fl r
|
.Fl r
|
||||||
.Op Fl cdiknuvzDYZ
|
.Op Fl cdiknuvzDOYZ
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl f Ar archive
|
.Op Fl f Ar archive
|
||||||
.Ek
|
.Ek
|
||||||
@ -104,7 +104,7 @@
|
|||||||
.Op Ar pattern ...\&
|
.Op Ar pattern ...\&
|
||||||
.Nm
|
.Nm
|
||||||
.Fl w
|
.Fl w
|
||||||
.Op Fl dituvzHLPX
|
.Op Fl dituvzHLOPX
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl b Ar blocksize
|
.Op Fl b Ar blocksize
|
||||||
.Ek
|
.Ek
|
||||||
@ -147,7 +147,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Fl r
|
.Fl r
|
||||||
.Fl w
|
.Fl w
|
||||||
.Op Fl diklntuvDHLPXYZ
|
.Op Fl diklntuvDHLOPXYZ
|
||||||
.Bk -words
|
.Bk -words
|
||||||
.Op Fl p Ar string
|
.Op Fl p Ar string
|
||||||
.Ar ...\&
|
.Ar ...\&
|
||||||
@ -853,6 +853,13 @@ Follow only command line symbolic links while performing a physical file
|
|||||||
system traversal.
|
system traversal.
|
||||||
.It Fl L
|
.It Fl L
|
||||||
Follow all symbolic links to perform a logical file system traversal.
|
Follow all symbolic links to perform a logical file system traversal.
|
||||||
|
.It Fl O
|
||||||
|
Force the archive to be one volume.
|
||||||
|
If a volume ends prematurely,
|
||||||
|
.Nm
|
||||||
|
will not prompt for a new volume.
|
||||||
|
This option can be useful for
|
||||||
|
automated tasks where error recovery cannot be performed by a human.
|
||||||
.It Fl P
|
.It Fl P
|
||||||
Do not follow symbolic links, perform a physical file system traversal.
|
Do not follow symbolic links, perform a physical file system traversal.
|
||||||
This is the default mode.
|
This is the default mode.
|
||||||
@ -1176,6 +1183,7 @@ The options
|
|||||||
.Fl G ,
|
.Fl G ,
|
||||||
.Fl H ,
|
.Fl H ,
|
||||||
.Fl L ,
|
.Fl L ,
|
||||||
|
.Fl O ,
|
||||||
.Fl P ,
|
.Fl P ,
|
||||||
.Fl T ,
|
.Fl T ,
|
||||||
.Fl U ,
|
.Fl U ,
|
||||||
|
@ -85,6 +85,7 @@ int vflag; /* produce verbose output */
|
|||||||
int Dflag; /* same as uflag except inode change time */
|
int Dflag; /* same as uflag except inode change time */
|
||||||
int Hflag; /* follow command line symlinks (write only) */
|
int Hflag; /* follow command line symlinks (write only) */
|
||||||
int Lflag; /* follow symlinks when writing */
|
int Lflag; /* follow symlinks when writing */
|
||||||
|
int Oflag; /* limit to single volume */
|
||||||
int Xflag; /* archive files with same device id only */
|
int Xflag; /* archive files with same device id only */
|
||||||
int Yflag; /* same as Dflg except after name mode */
|
int Yflag; /* same as Dflg except after name mode */
|
||||||
int Zflag; /* same as uflg except after name mode */
|
int Zflag; /* same as uflg except after name mode */
|
||||||
|
Loading…
Reference in New Issue
Block a user