diff options
author | peter <peter@FreeBSD.org> | 1998-06-05 14:43:42 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-06-05 14:43:42 +0000 |
commit | 00b7e773c5170cbb781853c5c38133d0549366c5 (patch) | |
tree | f332996c96a22c22db01fd28c26f30b2a2f58072 /usr.sbin/mtree | |
parent | 8d3569022185b777193cfe6f8ab66c54846d39a2 (diff) | |
download | FreeBSD-src-00b7e773c5170cbb781853c5c38133d0549366c5.zip FreeBSD-src-00b7e773c5170cbb781853c5c38133d0549366c5.tar.gz |
Create a new flag, "nochange", which will specify that a directory is
to be created if it's missing, otherwise completely ignore it's modes and
owners. Primary intended targets: /usr/src and /usr/obj.
Adjust the 'not created: File exists' message to mention that it's a
directory that's the problem, otherwise it doesn't make sense.
I had created chown-style -L and -P flag to control logical/physical mode
(ie: whether symlinks were followed), but the nochange flag is enough to
get the blasted thing out of my hair so I took them back out.
Diffstat (limited to 'usr.sbin/mtree')
-rw-r--r-- | usr.sbin/mtree/create.c | 4 | ||||
-rw-r--r-- | usr.sbin/mtree/misc.c | 3 | ||||
-rw-r--r-- | usr.sbin/mtree/mtree.8 | 5 | ||||
-rw-r--r-- | usr.sbin/mtree/mtree.c | 4 | ||||
-rw-r--r-- | usr.sbin/mtree/mtree.h | 4 | ||||
-rw-r--r-- | usr.sbin/mtree/verify.c | 15 |
6 files changed, 21 insertions, 14 deletions
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index 2638e2a..38f7d55 100644 --- a/usr.sbin/mtree/create.c +++ b/usr.sbin/mtree/create.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: create.c,v 1.9 1997/10/01 06:30:00 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -61,7 +61,7 @@ static const char rcsid[] = extern long int crc_total; extern int ftsoptions; extern int dflag, iflag, nflag, sflag; -extern u_short keys; +extern u_int keys; extern char fullpath[MAXPATHLEN]; extern int lineno; diff --git a/usr.sbin/mtree/misc.c b/usr.sbin/mtree/misc.c index 093265c..c8318ec 100644 --- a/usr.sbin/mtree/misc.c +++ b/usr.sbin/mtree/misc.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: misc.c,v 1.4 1997/10/01 06:30:01 charnier Exp $"; #endif /*not lint */ #include <sys/types.h> @@ -67,6 +67,7 @@ static KEY keylist[] = { {"md5digest", F_MD5, NEEDVALUE}, {"mode", F_MODE, NEEDVALUE}, {"nlink", F_NLINK, NEEDVALUE}, + {"nochange", F_NOCHANGE, 0}, {"size", F_SIZE, NEEDVALUE}, {"time", F_TIME, NEEDVALUE}, {"type", F_TYPE, NEEDVALUE}, diff --git a/usr.sbin/mtree/mtree.8 b/usr.sbin/mtree/mtree.8 index 8fedd94..0d18655 100644 --- a/usr.sbin/mtree/mtree.8 +++ b/usr.sbin/mtree/mtree.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93 -.\" $Id: mtree.8,v 1.10 1997/02/22 16:07:52 peter Exp $ +.\" $Id: mtree.8,v 1.11 1997/10/01 06:30:01 charnier Exp $ .\" .Dd February 9, 1995 .Dt MTREE 8 @@ -137,6 +137,9 @@ Ignore any file hierarchy below this file. The file group as a numeric value. .It Cm gname The file group as a symbolic name. +.It Cm nochange +Make sure this file or directory exists but otherwise ignore all attributes. +Ignore any hierarchy below this path. .It Cm md5digest The MD5 message digest of the file. .It Cm mode diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c index cf61a9b..76b945b 100644 --- a/usr.sbin/mtree/mtree.c +++ b/usr.sbin/mtree/mtree.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: mtree.c,v 1.6 1997/10/01 06:30:02 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -59,7 +59,7 @@ extern long int crc_total; int ftsoptions = FTS_LOGICAL; int cflag, dflag, eflag, iflag, nflag, rflag, sflag, uflag, Uflag; -u_short keys; +u_int keys; char fullpath[MAXPATHLEN]; static void usage __P((void)); diff --git a/usr.sbin/mtree/mtree.h b/usr.sbin/mtree/mtree.h index 4102274..b7678aa 100644 --- a/usr.sbin/mtree/mtree.h +++ b/usr.sbin/mtree/mtree.h @@ -71,7 +71,9 @@ typedef struct _node { #define F_UNAME 0x2000 /* user name */ #define F_VISIT 0x4000 /* file visited */ #define F_MD5 0x8000 /* MD5 digest */ - u_short flags; /* items set */ +#define F_NOCHANGE 0x10000 /* If owner/mode "wrong", do */ + /* not change */ + u_int flags; /* items set */ #define F_BLOCK 0x001 /* block special */ #define F_CHAR 0x002 /* char special */ diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 6610d3a..09b27e7 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: verify.c,v 1.5 1997/10/01 06:30:02 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -117,9 +117,10 @@ vwalk() !fnmatch(ep->name, p->fts_name, FNM_PATHNAME)) || !strcmp(ep->name, p->fts_name)) { ep->flags |= F_VISIT; - if (compare(ep->name, ep, p)) + if ((ep->flags & F_NOCHANGE) == 0 && + compare(ep->name, ep, p)) rval = MISMATCHEXIT; - if (ep->flags & F_IGN) + if (ep->flags & (F_IGN | F_NOCHANGE)) (void)fts_set(t, p, FTS_SKIP); else if (ep->child && ep->type == F_DIR && p->fts_info == FTS_D) { @@ -174,13 +175,13 @@ miss(p, tail) create = 0; if (!(p->flags & F_VISIT) && uflag) if (!(p->flags & (F_UID | F_UNAME))) - (void)printf(" (not created: user not specified)"); + (void)printf(" (directory not created: user not specified)"); else if (!(p->flags & (F_GID | F_GNAME))) - (void)printf(" (not created: group not specified)"); + (void)printf(" (directory not created: group not specified)"); else if (!(p->flags & F_MODE)) - (void)printf(" (not created: mode not specified)"); + (void)printf(" (directory not created: mode not specified)"); else if (mkdir(path, S_IRWXU)) - (void)printf(" (not created: %s)", + (void)printf(" (directory not created: %s)", strerror(errno)); else { create = 1; |