1 .\" Copyright (c) 1989, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93
29 .\" $FreeBSD: src/usr.sbin/mtree/mtree.8,v 1.53 2005/07/31 03:30:47 keramida Exp $
36 .Nd map a directory hierarchy
59 .Op Fl X Ar exclude-list
64 utility compares the file hierarchy rooted in the current directory against a
65 specification read from the standard input.
66 Messages are written to the standard output for any files whose
67 characteristics do not match the specifications, or which are
68 missing from either the file hierarchy or the specification.
70 The options are as follows:
74 Print a specification for the file hierarchy to the standard output.
77 Ignore everything except directory type files.
80 Do not complain about files that are in the file hierarchy, but not in the
84 Read the specification from
86 instead of from the standard input.
88 If this option is specified twice,
89 the two specifications are compared with each other,
90 rather than to the file hierarchy.
91 The specifications be sorted like output generated using
93 The output format in this case is somewhat remniscent of
95 having "in first spec only", "in second spec only", and "different"
96 columns, prefixed by zero, one and two TAB characters respectively.
97 Each entry in the "different" column occupies two lines,
98 one from each specification.
101 Indent the output 4 spaces each time a directory level is descended when
102 create a specification with the
105 This does not affect either the /set statements or the comment before each
107 It does however affect the comment before the close of each directory.
110 Add the specified (whitespace or comma separated)
112 to the current set of keywords.
115 Use the ``type'' keyword plus the specified (whitespace or comma separated)
117 instead of the current set of keywords.
120 Follow all symbolic links in the file hierarchy.
123 Do not emit pathname comments when creating a specification.
125 a comment is emitted before each directory and before the close of that
126 directory when using the
131 Do not follow symbolic links in the file hierarchy, instead consider
132 the symbolic link itself in any comparisons.
136 Use the file hierarchy rooted in
138 instead of the current directory.
142 Do not complain when a
144 directory cannot be created because it already exists.
145 This occurs when the directory is a symbolic link.
148 Remove any files in the file hierarchy that are not described in the
152 Skip calculating the digest of the extended attributes of the file.
155 Display a single checksum to the standard error output that represents all
156 of the files for which the keyword
159 The checksum is seeded with the specified value.
162 Modify the owner, group, permissions, and modification time of existing
163 files to match the specification and create any missing directories or
165 User, group and permissions must all be specified for missing directories
167 Corrected mismatches are not considered errors.
172 except a status of 2 is returned if the file hierarchy did not match
176 Make some error conditions non-fatal warnings.
178 .It Fl X Ar exclude-list
179 The specified file contains
181 patterns matching files to be excluded from
182 the specification, one to a line.
183 If the pattern contains a
185 character, it will be matched against entire pathnames (relative to
186 the starting directory); otherwise,
187 it will be matched against basenames only.
188 No comments are allowed in
194 Do not descend below mount points in the file hierarchy.
197 Specifications are mostly composed of ``keywords'', i.e., strings
198 that specify values relating to files.
199 No keywords have default values, and if a keyword has no value set, no
200 checks based on it are performed.
202 Currently supported keywords are as follows:
205 The checksum of the file using the default algorithm specified by
210 The file flags as a symbolic name.
213 for information on these names.
214 If no flags are to be set the string
216 may be used to override the current default.
218 Ignore any file hierarchy below this file.
220 The file group as a numeric value.
222 The file group as a symbolic name.
224 The MD5 message digest of the file.
230 message digest of the file.
231 .It Cm ripemd160digest
234 message digest of the file.
236 The current file's permissions as a numeric (octal) or symbolic
239 The number of hard links the file is expected to have.
241 Make sure this file or directory exists but otherwise ignore all attributes.
243 The file owner as a numeric value.
245 The file owner as a symbolic name.
247 The size, in bytes, of the file.
249 The file the symbolic link is expected to reference.
251 The last modification time of the file.
253 The creation (birth) time of the file.
255 The last access time of the file.
257 The last metadata modification time of the file.
259 The time the file was added to its parent folder.
261 The inode number of the file.
263 Digest of the extended attributes of the file.
265 Digest of the access control list of the file.
267 The type of the file; may be set to any one of the following:
269 .Bl -tag -width Cm -compact
273 character special device
287 The default set of keywords are
298 There are four types of lines in a specification.
300 The first type of line sets a global value for a keyword, and consists of
301 the string ``/set'' followed by whitespace, followed by sets of keyword/value
302 pairs, separated by whitespace.
303 Keyword/value pairs consist of a keyword, followed by an equals sign
304 (``=''), followed by a value, without whitespace characters.
305 Once a keyword has been set, its value remains unchanged until either
308 The second type of line unsets keywords and consists of the string
309 ``/unset'', followed by whitespace, followed by one or more keywords,
310 separated by whitespace.
312 The third type of line is a file specification and consists of a file
313 name, followed by whitespace, followed by zero or more whitespace
314 separated keyword/value pairs.
315 The file name may be preceded by whitespace characters.
316 The file name may contain any of the standard file name matching
317 characters (``['', ``]'', ``?'' or ``*''), in which case files
318 in the hierarchy will be associated with the first pattern that
321 Each of the keyword/value pairs consist of a keyword, followed by an
322 equals sign (``=''), followed by the keyword's value, without
323 whitespace characters.
324 These values override, without changing, the global value of the
325 corresponding keyword.
327 All paths are relative.
328 Specifying a directory will cause subsequent files to be searched
329 for in that directory hierarchy.
330 Which brings us to the last type of line in a specification: a line
331 containing only the string
333 causes the current directory
334 path to ascend one level.
336 Empty lines and lines whose first non-whitespace character is a hash
337 mark (``#'') are ignored.
341 utility exits with a status of 0 on success, 1 if any error occurred,
342 and 2 if the file hierarchy did not match the specification.
343 A status of 2 is converted to a status of 0 if the
347 .Bl -tag -width /etc/mtree -compact
349 system specification directory
358 options can be used in combination to create directory hierarchies
359 for distributions and other such things; the files in
361 were used to create almost all directories in this
381 digest capability was added in
383 in response to the widespread use of programs which can spoof
389 digests were added in
391 as new attacks have demonstrated weaknesses in
393 Support for file flags was added in
395 and mostly comes from