2006-09-13 00:22:49 +04:00
|
|
|
.\" $NetBSD: mtree.8,v 1.44 2006/09/12 20:22:49 pavel Exp $
|
1995-03-08 00:12:04 +03:00
|
|
|
.\"
|
1995-03-07 17:44:05 +03:00
|
|
|
.\" Copyright (c) 1989, 1990, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
1993-11-02 10:51:06 +03:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2003-08-07 15:25:11 +04:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1993-11-02 10:51:06 +03:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2004-07-22 20:51:45 +04:00
|
|
|
.\" Copyright (c) 2001-2004 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Luke Mewburn of Wasabi Systems.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
1995-03-07 17:44:05 +03:00
|
|
|
.\" @(#)mtree.8 8.2 (Berkeley) 12/11/93
|
1993-11-02 10:51:06 +03:00
|
|
|
.\"
|
2006-09-13 00:22:49 +04:00
|
|
|
.Dd September 12, 2006
|
1993-11-02 10:51:06 +03:00
|
|
|
.Dt MTREE 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm mtree
|
|
|
|
.Nd map a directory hierarchy
|
|
|
|
.Sh SYNOPSIS
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2004-07-22 20:51:45 +04:00
|
|
|
.Op Fl cCdDelLMPruUWx
|
1999-03-07 14:58:22 +03:00
|
|
|
.Bk -words
|
1999-02-11 18:32:23 +03:00
|
|
|
.Op Fl i | Fl m
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1993-11-02 10:51:06 +03:00
|
|
|
.Op Fl f Ar spec
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2001-10-01 06:30:40 +04:00
|
|
|
.Op Fl p Ar path
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1993-11-02 10:51:06 +03:00
|
|
|
.Op Fl k Ar keywords
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2001-10-01 06:30:40 +04:00
|
|
|
.Op Fl K Ar keywords
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl R Ar keywords
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2001-10-04 08:51:27 +04:00
|
|
|
.Op Fl E Ar tags
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl I Ar tags
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2002-01-24 06:20:11 +03:00
|
|
|
.Op Fl N Ar dbdir
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1993-11-02 10:51:06 +03:00
|
|
|
.Op Fl s Ar seed
|
1999-03-07 14:58:22 +03:00
|
|
|
.Ek
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl X Ar exclude-file
|
|
|
|
.Ek
|
1993-11-02 10:51:06 +03:00
|
|
|
.Sh DESCRIPTION
|
2003-03-31 12:44:22 +04:00
|
|
|
The
|
1997-10-17 15:46:30 +04:00
|
|
|
.Nm
|
2003-03-31 12:44:22 +04:00
|
|
|
utility compares the file hierarchy rooted in the current directory
|
|
|
|
against a specification read from the standard input.
|
1993-11-02 10:51:06 +03:00
|
|
|
Messages are written to the standard output for any files whose
|
1995-03-07 18:28:32 +03:00
|
|
|
characteristics do not match the specification, or which are
|
1993-11-02 10:51:06 +03:00
|
|
|
missing from either the file hierarchy or the specification.
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width flag
|
|
|
|
.It Fl c
|
|
|
|
Print a specification for the file hierarchy to the standard output.
|
|
|
|
.It Fl d
|
|
|
|
Ignore everything except directory type files.
|
2002-12-23 07:40:19 +03:00
|
|
|
.It Fl C
|
2001-10-01 06:30:40 +04:00
|
|
|
Print
|
|
|
|
.Pq Sq dump
|
|
|
|
the specification as provided by
|
|
|
|
.Fl f Ar spec
|
|
|
|
in a format that's easier to parse with various tools.
|
2002-12-23 07:40:19 +03:00
|
|
|
The full path name is always printed as the first field, and
|
2001-10-01 06:30:40 +04:00
|
|
|
.Fl k ,
|
|
|
|
.Fl K ,
|
|
|
|
and
|
|
|
|
.Fl R
|
2001-10-04 08:51:27 +04:00
|
|
|
can be used to control which other keywords are printed,
|
|
|
|
and
|
|
|
|
.Fl E
|
|
|
|
and
|
2002-12-09 16:42:08 +03:00
|
|
|
.Fl I
|
2001-10-04 08:51:27 +04:00
|
|
|
can be used to control which files are printed.
|
2002-12-23 07:40:19 +03:00
|
|
|
.It Fl D
|
|
|
|
As per
|
|
|
|
.Fl C ,
|
|
|
|
except that the path name is always printed as the last field instead of
|
|
|
|
the first.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl E Ar tags
|
|
|
|
Add the comma separated tags to the
|
|
|
|
.Dq exclusion
|
|
|
|
list.
|
2001-10-05 05:03:24 +04:00
|
|
|
Non-directories with tags which are in the exclusion list are not printed with
|
2001-10-04 08:51:27 +04:00
|
|
|
.Fl D .
|
1993-11-02 10:51:06 +03:00
|
|
|
.It Fl e
|
|
|
|
Don't complain about files that are in the file hierarchy, but not in the
|
|
|
|
specification.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl f Ar spec
|
1993-11-02 10:51:06 +03:00
|
|
|
Read the specification from
|
|
|
|
.Ar file ,
|
|
|
|
instead of from the standard input.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl I Ar tags
|
|
|
|
Add the comma separated tags to the
|
|
|
|
.Dq inclusion
|
|
|
|
list.
|
2001-10-05 05:03:24 +04:00
|
|
|
Non-directories with tags which are in the inclusion list are printed with
|
2001-10-04 08:51:27 +04:00
|
|
|
.Fl D .
|
|
|
|
If no inclusion list is provided, the default is to display all files.
|
1999-02-11 18:32:23 +03:00
|
|
|
.It Fl i
|
|
|
|
If specified, set the schg and/or sappnd flags.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl K Ar keywords
|
1993-11-02 10:51:06 +03:00
|
|
|
Add the specified (whitespace or comma separated) keywords to the current
|
|
|
|
set of keywords.
|
2001-10-05 17:14:56 +04:00
|
|
|
If
|
|
|
|
.Ql all
|
2001-10-08 04:53:30 +04:00
|
|
|
is specified, add all of the other keywords.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl k Ar keywords
|
2001-10-05 17:14:56 +04:00
|
|
|
Use the
|
|
|
|
.Sy type
|
|
|
|
keyword plus the specified (whitespace or comma separated)
|
1993-11-02 10:51:06 +03:00
|
|
|
keywords instead of the current set of keywords.
|
2001-10-05 17:14:56 +04:00
|
|
|
If
|
|
|
|
.Ql all
|
2001-10-08 04:53:30 +04:00
|
|
|
is specified, use all of the other keywords.
|
2006-09-13 00:22:49 +04:00
|
|
|
If the
|
|
|
|
.Sy type
|
|
|
|
keyword is not desired, suppress it with
|
|
|
|
.Fl R Ar type .
|
2001-09-22 07:56:29 +04:00
|
|
|
.It Fl l
|
2001-10-04 15:24:05 +04:00
|
|
|
Do
|
2001-09-22 07:56:29 +04:00
|
|
|
.Dq loose
|
|
|
|
permissions checks, in which more stringent permissions
|
|
|
|
will match less stringent ones. For example, a file marked mode 0444
|
|
|
|
will pass a check for mode 0644.
|
|
|
|
.Dq Loose
|
|
|
|
checks apply only to read, write and execute permissions -- in
|
|
|
|
particular, if other bits like the sticky bit or suid/sgid bits are
|
|
|
|
set either in the specification or the file, exact checking will be
|
|
|
|
performed. This flag may not be set at the same time as the
|
|
|
|
.Fl u
|
|
|
|
or
|
|
|
|
.Fl U
|
|
|
|
flags.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.It Fl L
|
|
|
|
Follow all symbolic links in the file hierarchy.
|
1999-02-11 18:32:23 +03:00
|
|
|
.It Fl m
|
|
|
|
If the schg and/or sappnd flags are specified, reset these flags. Note that
|
2006-04-22 23:35:35 +04:00
|
|
|
this is only possible with securelevel less than 1 (i.e. in single user mode
|
1999-02-11 18:32:23 +03:00
|
|
|
or while the system is running in insecure mode). See
|
|
|
|
.Xr init 8
|
|
|
|
for information on security levels.
|
2004-07-22 20:51:45 +04:00
|
|
|
.It Fl M
|
|
|
|
Permit merging of specification entries with different types,
|
|
|
|
with the last entry take precedence.
|
2002-01-24 06:20:11 +03:00
|
|
|
.It Fl N Ar dbdir
|
|
|
|
Use the user database text file
|
|
|
|
.Pa master.passwd
|
|
|
|
and group database text file
|
|
|
|
.Pa group
|
|
|
|
from
|
|
|
|
.Ar dbdir ,
|
|
|
|
rather than using the results from the system's
|
|
|
|
.Xr getpwnam 3
|
|
|
|
and
|
|
|
|
.Xr getgrnam 3
|
|
|
|
(and related) library calls.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl p Ar path
|
1993-11-02 10:51:06 +03:00
|
|
|
Use the file hierarchy rooted in
|
|
|
|
.Ar path ,
|
|
|
|
instead of the current directory.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.It Fl P
|
|
|
|
Don't follow symbolic links in the file hierarchy, instead consider
|
|
|
|
the symbolic link itself in any comparisons.
|
|
|
|
This is the default.
|
|
|
|
.It Fl r
|
|
|
|
Remove any files in the file hierarchy that are not described in the
|
|
|
|
specification.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl R Ar keywords
|
|
|
|
Remove the specified (whitespace or comma separated) keywords from the current
|
|
|
|
set of keywords.
|
2001-10-05 17:14:56 +04:00
|
|
|
If
|
|
|
|
.Ql all
|
2001-10-08 04:53:30 +04:00
|
|
|
is specified, remove all of the other keywords.
|
2001-10-04 08:51:27 +04:00
|
|
|
.It Fl s Ar seed
|
1993-11-02 10:51:06 +03:00
|
|
|
Display a single checksum to the standard error output that represents all
|
|
|
|
of the files for which the keyword
|
2001-10-05 17:14:56 +04:00
|
|
|
.Sy cksum
|
1993-11-02 10:51:06 +03:00
|
|
|
was specified.
|
|
|
|
The checksum is seeded with the specified value.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.It Fl u
|
|
|
|
Modify the owner, group, permissions, and flags of existing files,
|
|
|
|
the device type of devices, and symbolic link targets,
|
|
|
|
to match the specification.
|
|
|
|
Create any missing directories, devices or symbolic links.
|
1993-11-02 10:51:06 +03:00
|
|
|
User, group, and permissions must all be specified for missing directories
|
|
|
|
to be created.
|
1999-02-11 18:32:23 +03:00
|
|
|
Note that unless the
|
|
|
|
.Fl i
|
|
|
|
option is given, the schg and sappnd flags will not be set, even if
|
2001-10-04 15:24:05 +04:00
|
|
|
specified. If
|
1999-02-11 18:32:23 +03:00
|
|
|
.Fl m
|
|
|
|
is given, these flags will be reset.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
Exit with a status of 0 on success,
|
|
|
|
2 if the file hierarchy did not match the specification, and
|
|
|
|
1 if any other error occurred.
|
|
|
|
.It Fl U
|
1997-08-20 19:14:51 +04:00
|
|
|
Same as
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Fl u
|
|
|
|
except that a mismatch is not considered to be an error if it was corrected.
|
2001-10-25 18:47:39 +04:00
|
|
|
.It Fl W
|
|
|
|
Don't attempt to set various file attributes such as the
|
|
|
|
ownership, mode, flags, or time
|
|
|
|
when creating new directories or changing existing entries.
|
|
|
|
This option will be most useful when used in conjunction with
|
|
|
|
.Fl u
|
|
|
|
or
|
|
|
|
.Fl U .
|
1993-11-02 10:51:06 +03:00
|
|
|
.It Fl x
|
|
|
|
Don't descend below mount points in the file hierarchy.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.It Fl X Ar exclude-file
|
|
|
|
The specified file contains
|
|
|
|
.Xr fnmatch 3
|
|
|
|
patterns matching files to be excluded from
|
|
|
|
the specification, one to a line.
|
|
|
|
If the pattern contains a
|
|
|
|
.Ql \&/
|
|
|
|
character, it will be matched against entire pathnames (relative to
|
|
|
|
the starting directory); otherwise,
|
|
|
|
it will be matched against basenames only.
|
|
|
|
Comments are permitted in
|
|
|
|
the
|
|
|
|
.Ar exclude-list
|
|
|
|
file.
|
1993-11-02 10:51:06 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
2001-10-05 17:14:56 +04:00
|
|
|
Specifications are mostly composed of
|
|
|
|
.Dq keywords ,
|
|
|
|
i.e. strings that
|
1993-11-02 10:51:06 +03:00
|
|
|
that specify values relating to files.
|
|
|
|
No keywords have default values, and if a keyword has no value set, no
|
|
|
|
checks based on it are performed.
|
|
|
|
.Pp
|
|
|
|
Currently supported keywords are as follows:
|
2001-10-05 17:14:56 +04:00
|
|
|
.Bl -tag -width Sy
|
|
|
|
.It Sy cksum
|
1993-11-02 10:51:06 +03:00
|
|
|
The checksum of the file using the default algorithm specified by
|
|
|
|
the
|
|
|
|
.Xr cksum 1
|
|
|
|
utility.
|
2001-10-09 08:50:00 +04:00
|
|
|
.It Sy device
|
|
|
|
The device number to use for
|
|
|
|
.Sy block
|
|
|
|
or
|
|
|
|
.Sy char
|
|
|
|
file types.
|
|
|
|
The argument must be one of the following forms:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width 4n
|
|
|
|
.It Xo
|
|
|
|
.Sm off
|
|
|
|
.Ar format ,
|
|
|
|
.Ar major ,
|
|
|
|
.Ar minor
|
|
|
|
.Sm on
|
|
|
|
.Xc
|
|
|
|
A device with
|
|
|
|
.Ar major
|
|
|
|
and
|
|
|
|
.Ar minor
|
|
|
|
fields, for an operating system specified with
|
|
|
|
.Ar format .
|
|
|
|
See below for valid formats.
|
|
|
|
.It Xo
|
|
|
|
.Sm off
|
|
|
|
.Ar format ,
|
|
|
|
.Ar major ,
|
|
|
|
.Ar unit ,
|
|
|
|
.Ar subunit
|
|
|
|
.Sm on
|
|
|
|
.Xc
|
|
|
|
A device with
|
|
|
|
.Ar major ,
|
|
|
|
.Ar unit ,
|
|
|
|
and
|
|
|
|
.Ar subunit
|
|
|
|
fields, for an operating system specified with
|
|
|
|
.Ar format .
|
|
|
|
(Currently this is only supported by the
|
|
|
|
.Sy bsdos
|
|
|
|
format.)
|
|
|
|
.It Ar number
|
|
|
|
Opaque number (as stored on the file system).
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The following values for
|
|
|
|
.Ar format
|
|
|
|
are recognized:
|
|
|
|
.Sy native ,
|
|
|
|
.Sy 386bsd ,
|
|
|
|
.Sy 4bsd ,
|
|
|
|
.Sy bsdos ,
|
|
|
|
.Sy freebsd ,
|
|
|
|
.Sy hpux ,
|
|
|
|
.Sy isc ,
|
|
|
|
.Sy linux ,
|
|
|
|
.Sy netbsd ,
|
|
|
|
.Sy osf1 ,
|
|
|
|
.Sy sco ,
|
|
|
|
.Sy solaris ,
|
|
|
|
.Sy sunos ,
|
|
|
|
.Sy svr3 ,
|
|
|
|
.Sy svr4 ,
|
|
|
|
and
|
|
|
|
.Sy ultrix .
|
|
|
|
.Pp
|
|
|
|
See
|
|
|
|
.Xr mknod 8
|
|
|
|
for more details.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy flags
|
1998-10-10 11:50:27 +04:00
|
|
|
The file flags as a symbolic name. See
|
|
|
|
.Xr chflags 1
|
|
|
|
for information on these names. If no flags are to be set the string
|
2001-10-05 17:14:56 +04:00
|
|
|
.Ql none
|
1998-10-10 11:50:27 +04:00
|
|
|
may be used to override the current default.
|
1999-02-11 18:32:23 +03:00
|
|
|
Note that the schg and sappnd flags are treated specially (see the
|
|
|
|
.Fl i
|
|
|
|
and
|
|
|
|
.Fl m
|
|
|
|
options).
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy ignore
|
1993-11-02 10:51:06 +03:00
|
|
|
Ignore any file hierarchy below this file.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy gid
|
1993-11-02 10:51:06 +03:00
|
|
|
The file group as a numeric value.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy gname
|
1993-11-02 10:51:06 +03:00
|
|
|
The file group as a symbolic name.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy link
|
1995-03-08 00:26:23 +03:00
|
|
|
The file the symbolic link is expected to reference.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy md5
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
The
|
|
|
|
.Tn MD5
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy md5digest
|
|
|
|
Synonym for
|
|
|
|
.Sy md5 .
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy mode
|
1993-11-02 10:51:06 +03:00
|
|
|
The current file's permissions as a numeric (octal) or symbolic
|
|
|
|
value.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy nlink
|
1993-11-02 10:51:06 +03:00
|
|
|
The number of hard links the file is expected to have.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy optional
|
1995-03-08 00:26:23 +03:00
|
|
|
The file is optional; don't complain about the file if it's
|
|
|
|
not in the file hierarchy.
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.It Sy rmd160
|
|
|
|
The
|
|
|
|
.Tn RMD-160
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy rmd160digest
|
|
|
|
Synonym for
|
|
|
|
.Sy rmd160 .
|
|
|
|
.It Sy sha1
|
|
|
|
The
|
|
|
|
.Tn SHA-1
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy sha1digest
|
|
|
|
Synonym for
|
|
|
|
.Sy sha1 .
|
2005-08-25 00:55:41 +04:00
|
|
|
.It Sy sha256
|
|
|
|
The 256-bits
|
|
|
|
.Tn SHA-2
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy sha256digest
|
|
|
|
Synonym for
|
|
|
|
.Sy sha256 .
|
|
|
|
.It Sy sha384
|
|
|
|
The 384-bits
|
|
|
|
.Tn SHA-2
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy sha384digest
|
|
|
|
Synonym for
|
|
|
|
.Sy sha384 .
|
|
|
|
.It Sy sha512
|
|
|
|
The 512-bits
|
|
|
|
.Tn SHA-2
|
|
|
|
cryptographic message digest of the file.
|
|
|
|
.It Sy sha512digest
|
|
|
|
Synonym for
|
|
|
|
.Sy sha512 .
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy size
|
1993-11-02 10:51:06 +03:00
|
|
|
The size, in bytes, of the file.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy tags
|
2001-10-04 08:51:27 +04:00
|
|
|
Comma delimited tags to be matched with
|
|
|
|
.Fl E
|
|
|
|
and
|
|
|
|
.Fl I .
|
|
|
|
These may be specified without leading or trailing commas, but will be
|
|
|
|
stored internally with them.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy time
|
1993-11-02 10:51:06 +03:00
|
|
|
The last modification time of the file.
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy type
|
1993-11-02 10:51:06 +03:00
|
|
|
The type of the file; may be set to any one of the following:
|
2001-10-08 04:53:30 +04:00
|
|
|
.Pp
|
2001-10-05 17:14:56 +04:00
|
|
|
.Bl -tag -width Sy -compact
|
|
|
|
.It Sy block
|
1993-11-02 10:51:06 +03:00
|
|
|
block special device
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy char
|
1993-11-02 10:51:06 +03:00
|
|
|
character special device
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy dir
|
1993-11-02 10:51:06 +03:00
|
|
|
directory
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy fifo
|
1993-11-02 10:51:06 +03:00
|
|
|
fifo
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy file
|
1993-11-02 10:51:06 +03:00
|
|
|
regular file
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy link
|
1993-11-02 10:51:06 +03:00
|
|
|
symbolic link
|
2001-10-05 17:14:56 +04:00
|
|
|
.It Sy socket
|
1993-11-02 10:51:06 +03:00
|
|
|
socket
|
|
|
|
.El
|
2002-12-27 09:31:51 +03:00
|
|
|
.It Sy uid
|
|
|
|
The file owner as a numeric value.
|
|
|
|
.It Sy uname
|
|
|
|
The file owner as a symbolic name.
|
1993-11-02 10:51:06 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The default set of keywords are
|
2001-10-05 17:14:56 +04:00
|
|
|
.Sy flags ,
|
|
|
|
.Sy gid ,
|
|
|
|
.Sy link ,
|
|
|
|
.Sy mode ,
|
|
|
|
.Sy nlink ,
|
|
|
|
.Sy size ,
|
|
|
|
.Sy time ,
|
|
|
|
.Sy type ,
|
1993-11-02 10:51:06 +03:00
|
|
|
and
|
2001-10-05 17:14:56 +04:00
|
|
|
.Sy uid .
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
2001-10-19 06:57:34 +04:00
|
|
|
There are four types of lines in a specification:
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
2001-10-19 06:57:34 +04:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
Set global values for a keyword.
|
|
|
|
This consists of the string
|
2001-10-05 17:14:56 +04:00
|
|
|
.Ql /set
|
|
|
|
followed by whitespace, followed by sets of keyword/value
|
1993-11-02 10:51:06 +03:00
|
|
|
pairs, separated by whitespace.
|
|
|
|
Keyword/value pairs consist of a keyword, followed by an equals sign
|
2001-10-05 17:14:56 +04:00
|
|
|
.Pq Ql = ,
|
|
|
|
followed by a value, without whitespace characters.
|
1993-11-02 10:51:06 +03:00
|
|
|
Once a keyword has been set, its value remains unchanged until either
|
|
|
|
reset or unset.
|
2001-10-19 06:57:34 +04:00
|
|
|
.It
|
|
|
|
Unset global values for a keyword.
|
|
|
|
This consists of the string
|
2001-10-05 17:14:56 +04:00
|
|
|
.Ql /unset ,
|
|
|
|
followed by whitespace, followed by one or more keywords,
|
1993-11-02 10:51:06 +03:00
|
|
|
separated by whitespace.
|
2002-02-05 15:15:13 +03:00
|
|
|
If
|
|
|
|
.Ql all
|
|
|
|
is specified, unset all of the keywords.
|
2001-10-19 06:57:34 +04:00
|
|
|
.It
|
|
|
|
A file specification, consisting of a path name, followed by whitespace,
|
|
|
|
followed by zero or more whitespace separated keyword/value pairs.
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
2001-10-19 06:57:34 +04:00
|
|
|
The path name may be preceded by whitespace characters.
|
|
|
|
The path name may contain any of the standard path name matching
|
2001-10-05 17:14:56 +04:00
|
|
|
characters
|
|
|
|
.Po
|
2003-06-28 03:21:50 +04:00
|
|
|
.Ql \&[ ,
|
|
|
|
.Ql \&] ,
|
|
|
|
.Ql \&?
|
2001-10-05 17:14:56 +04:00
|
|
|
or
|
|
|
|
.Ql *
|
2002-01-19 14:44:57 +03:00
|
|
|
.Pc ,
|
2001-10-05 17:14:56 +04:00
|
|
|
in which case files
|
1993-11-02 10:51:06 +03:00
|
|
|
in the hierarchy will be associated with the first pattern that
|
|
|
|
they match.
|
1999-11-07 23:23:01 +03:00
|
|
|
.Nm
|
2000-11-07 08:44:50 +03:00
|
|
|
uses
|
|
|
|
.Xr strsvis 3
|
2001-10-19 06:57:34 +04:00
|
|
|
(in VIS_CSTYLE format) to encode path names containing
|
1999-11-07 23:23:01 +03:00
|
|
|
non-printable characters. Whitespace characters are encoded as
|
2001-10-05 17:14:56 +04:00
|
|
|
.Ql \es
|
|
|
|
(space),
|
|
|
|
.Ql \et
|
|
|
|
(tab), and
|
|
|
|
.Ql \en
|
|
|
|
(new line).
|
|
|
|
.Ql #
|
2001-10-19 06:57:34 +04:00
|
|
|
characters in path names are escaped by a preceding backslash
|
2001-10-05 17:14:56 +04:00
|
|
|
.Ql \e
|
1999-11-07 23:23:01 +03:00
|
|
|
to distinguish them from comments.
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
|
|
|
Each of the keyword/value pairs consist of a keyword, followed by an
|
2001-10-05 17:14:56 +04:00
|
|
|
equals sign
|
|
|
|
.Pq Ql = ,
|
|
|
|
followed by the keyword's value, without
|
1993-11-02 10:51:06 +03:00
|
|
|
whitespace characters.
|
|
|
|
These values override, without changing, the global value of the
|
|
|
|
corresponding keyword.
|
|
|
|
.Pp
|
2001-10-22 11:11:46 +04:00
|
|
|
The first path name entry listed must be a directory named
|
|
|
|
.Ql \&. ,
|
|
|
|
as this ensures that intermixing full and relative path names will
|
|
|
|
work consistently and correctly.
|
2002-02-11 15:43:55 +03:00
|
|
|
Multiple entries for a directory named
|
|
|
|
.Ql \&.
|
|
|
|
are permitted; the settings for the last such entry override those
|
|
|
|
of the existing entry.
|
2001-10-22 11:11:46 +04:00
|
|
|
.Pp
|
2001-10-19 06:57:34 +04:00
|
|
|
A path name that contains a slash
|
2001-10-05 19:32:57 +04:00
|
|
|
.Pq Ql /
|
2001-10-08 04:53:30 +04:00
|
|
|
that is not the first character will be treated as a full path
|
2001-10-05 19:32:57 +04:00
|
|
|
(relative to the root of the tree).
|
2001-10-19 06:57:34 +04:00
|
|
|
All parent directories referenced in the path name must exist.
|
|
|
|
The current directory path used by relative path names will be updated
|
2001-10-05 19:32:57 +04:00
|
|
|
appropriately.
|
2002-02-11 15:43:55 +03:00
|
|
|
Multiple entries for the same full path are permitted if the types
|
2004-07-22 20:51:45 +04:00
|
|
|
are the same (unless
|
|
|
|
.Fl M
|
|
|
|
is given, and then the types may differ);
|
2002-02-11 15:43:55 +03:00
|
|
|
in this case the settings for the last entry take precedence.
|
2001-10-05 19:32:57 +04:00
|
|
|
.Pp
|
2001-10-19 06:57:34 +04:00
|
|
|
A path name that does not contain a slash will be treated as a relative path.
|
1993-11-02 10:51:06 +03:00
|
|
|
Specifying a directory will cause subsequent files to be searched
|
|
|
|
for in that directory hierarchy.
|
2001-10-19 06:57:34 +04:00
|
|
|
.It
|
|
|
|
A line containing only the string
|
|
|
|
.Ql \&..
|
|
|
|
which causes the current directory path (used by relative paths)
|
|
|
|
to ascend one level.
|
|
|
|
.El
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
|
|
|
Empty lines and lines whose first non-whitespace character is a hash
|
2001-10-05 17:14:56 +04:00
|
|
|
mark
|
|
|
|
.Pq Ql #
|
|
|
|
are ignored.
|
1993-11-02 10:51:06 +03:00
|
|
|
.Pp
|
|
|
|
The
|
1997-10-17 15:46:30 +04:00
|
|
|
.Nm
|
1993-11-02 10:51:06 +03:00
|
|
|
utility exits with a status of 0 on success, 1 if any error occurred,
|
|
|
|
and 2 if the file hierarchy did not match the specification.
|
2001-10-04 15:24:05 +04:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/mtree -compact
|
|
|
|
.It Pa /etc/mtree
|
|
|
|
system specification directory
|
|
|
|
.El
|
1993-11-02 10:51:06 +03:00
|
|
|
.Sh EXAMPLES
|
2001-10-05 17:14:56 +04:00
|
|
|
To detect system binaries that have been
|
|
|
|
.Dq trojan horsed ,
|
|
|
|
it is recommended that
|
1997-10-17 15:46:30 +04:00
|
|
|
.Nm
|
1993-11-02 10:51:06 +03:00
|
|
|
be run on the file systems, and a copy of the results stored on a different
|
|
|
|
machine, or, at least, in encrypted form.
|
|
|
|
The seed for the
|
|
|
|
.Fl s
|
|
|
|
option should not be an obvious value and the final checksum should not be
|
|
|
|
stored on-line under any circumstances!
|
|
|
|
Then, periodically,
|
1997-10-17 15:46:30 +04:00
|
|
|
.Nm
|
1993-11-02 10:51:06 +03:00
|
|
|
should be run against the on-line specifications and the final checksum
|
|
|
|
compared with the previous value.
|
|
|
|
While it is possible for the bad guys to change the on-line specifications
|
|
|
|
to conform to their modified binaries, it shouldn't be possible for them
|
|
|
|
to make it produce the same final checksum value.
|
|
|
|
If the final checksum value changes, the off-line copies of the specification
|
|
|
|
can be used to detect which of the binaries have actually been modified.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fl d
|
|
|
|
and
|
|
|
|
.Fl u
|
|
|
|
options can be used in combination to create directory hierarchies
|
|
|
|
for distributions and other such things.
|
|
|
|
.Sh SEE ALSO
|
1998-10-10 11:50:27 +04:00
|
|
|
.Xr chflags 1 ,
|
1993-11-02 10:51:06 +03:00
|
|
|
.Xr chgrp 1 ,
|
1998-10-10 11:50:27 +04:00
|
|
|
.Xr chmod 1 ,
|
1993-11-02 10:51:06 +03:00
|
|
|
.Xr cksum 1 ,
|
|
|
|
.Xr stat 2 ,
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Xr fnmatch 3 ,
|
1993-11-02 10:51:06 +03:00
|
|
|
.Xr fts 3 ,
|
2001-10-04 08:51:27 +04:00
|
|
|
.Xr strsvis 3 ,
|
2001-10-09 08:50:00 +04:00
|
|
|
.Xr chown 8 ,
|
|
|
|
.Xr mknod 8
|
1993-11-02 10:51:06 +03:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1997-10-17 15:46:30 +04:00
|
|
|
.Nm
|
1993-11-02 10:51:06 +03:00
|
|
|
utility appeared in
|
|
|
|
.Bx 4.3 Reno .
|
2001-10-05 19:32:57 +04:00
|
|
|
The
|
|
|
|
.Sy optional
|
|
|
|
keyword appeared in
|
|
|
|
.Nx 1.2 .
|
|
|
|
The
|
|
|
|
.Fl U
|
|
|
|
flag appeared in
|
|
|
|
.Nx 1.3 .
|
|
|
|
The
|
|
|
|
.Sy flags
|
|
|
|
and
|
|
|
|
.Sy md5
|
|
|
|
keywords, and
|
|
|
|
.Fl i
|
|
|
|
and
|
|
|
|
.Fl m
|
|
|
|
flags
|
|
|
|
appeared in
|
|
|
|
.Nx 1.4 .
|
|
|
|
The
|
2001-10-09 08:50:00 +04:00
|
|
|
.Sy device ,
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Sy rmd160 ,
|
|
|
|
.Sy sha1 ,
|
2001-10-09 08:50:00 +04:00
|
|
|
.Sy tags ,
|
2001-10-05 19:32:57 +04:00
|
|
|
and
|
|
|
|
.Sy all
|
|
|
|
keywords,
|
|
|
|
.Fl D ,
|
|
|
|
.Fl E ,
|
2001-10-25 18:47:39 +04:00
|
|
|
.Fl I ,
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Fl l ,
|
|
|
|
.Fl L ,
|
2002-01-24 06:20:11 +03:00
|
|
|
.Fl N ,
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Fl P ,
|
2001-10-25 18:47:39 +04:00
|
|
|
.Fl R ,
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Fl W ,
|
2001-10-05 19:32:57 +04:00
|
|
|
and
|
User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 11:01:51 +03:00
|
|
|
.Fl X
|
2001-10-08 04:53:30 +04:00
|
|
|
flags, and support for full paths appeared in
|
2001-10-05 19:32:57 +04:00
|
|
|
.Nx 1.6 .
|
2005-08-25 00:55:41 +04:00
|
|
|
The
|
|
|
|
.Sy sha256 ,
|
|
|
|
.Sy sha384 ,
|
|
|
|
and
|
|
|
|
.Sy sha512
|
|
|
|
keywords appeared in
|
2005-11-10 22:41:59 +03:00
|
|
|
.Nx 3.0 .
|