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.
This commit is contained in:
Peter Wemm 1998-06-05 14:43:42 +00:00
parent 3dead0b645
commit 7840cfdd8b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36670
6 changed files with 21 additions and 14 deletions

View file

@ -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;

View file

@ -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},

View file

@ -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

View file

@ -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));

View file

@ -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 */

View file

@ -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;