Implement FreeBSD's "nochange" keyworld which causes the existance of a

filesystem object to be checked but none of its attiributes.(brooks)
This commit is contained in:
christos 2012-10-05 01:31:05 +00:00
parent 23fe062937
commit b73d92b069
4 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $ */
/* $NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $");
__RCSID("$NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -71,6 +71,7 @@ static KEY keylist[] = {
{"md5digest", F_MD5, NEEDVALUE},
{"mode", F_MODE, NEEDVALUE},
{"nlink", F_NLINK, NEEDVALUE},
{"nochange", F_NOCHANGE, 0},
{"optional", F_OPT, 0},
{"ripemd160digest", F_RMD160, NEEDVALUE},
{"rmd160digest",F_RMD160, NEEDVALUE},

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mtree.8,v 1.61 2012/10/05 01:30:36 christos Exp $
.\" $NetBSD: mtree.8,v 1.62 2012/10/05 01:31:05 christos Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -450,6 +450,8 @@ The current file's permissions as a numeric (octal) or symbolic
value.
.It Sy nlink
The number of hard links the file is expected to have.
.It Sy nochange
Make sure this file or directory exists but otherwise ignore all attributes.
.It Sy optional
The file is optional; don't complain about the file if it's
not in the file hierarchy.

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtree.h,v 1.29 2012/10/05 01:26:56 christos Exp $ */
/* $NetBSD: mtree.h,v 1.30 2012/10/05 01:31:05 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -86,6 +86,8 @@ typedef struct _node {
#define F_UID 0x00080000 /* uid */
#define F_UNAME 0x00100000 /* user name */
#define F_VISIT 0x00200000 /* file visited */
#define F_NOCHANGE 0x00400000 /* check existance, but not */
/* other properties */
#define F_SHA256 0x00800000 /* SHA256 digest */
#define F_SHA384 0x01000000 /* SHA384 digest */
#define F_SHA512 0x02000000 /* SHA512 digest */

View File

@ -1,4 +1,4 @@
/* $NetBSD: verify.c,v 1.42 2012/10/05 01:26:56 christos Exp $ */
/* $NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: verify.c,v 1.42 2012/10/05 01:26:56 christos Exp $");
__RCSID("$NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $");
#endif
#endif /* not lint */
@ -124,7 +124,8 @@ vwalk(void)
!fnmatch(ep->name, p->fts_name, FNM_PATHNAME)) ||
!strcmp(ep->name, p->fts_name)) {
ep->flags |= F_VISIT;
if (compare(ep, p))
if ((ep->flags & F_NOCHANGE) == 0 &&
compare(ep, p))
rval = MISMATCHEXIT;
if (!(ep->flags & F_IGN) &&
ep->type == F_DIR &&