This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / usr.sbin / mtree / mtree.1
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
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.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)mtree.1 5.10 (Berkeley) 7/30/91
33.\"
34.Dd July 30, 1991
35.Dt MTREE 8
36.Os
37.Sh NAME
38.Nm mtree
39.Nd map a directory hierarchy
40.Sh SYNOPSIS
41.Nm mtree
42.Op Fl cderux
43.Op Fl f Ar spec
44.Op Fl p Ar path
45.Sh DESCRIPTION
46The utility
47.Nm mtree
48compares a directory hierarchy against a specification for a
49directory hierarchy.
50By default, the specification is read from the standard input.
51.Nm Mtree
52verifies that the tree rooted in the current directory matches the
53specification.
54.Pp
55Messages are written to standard output for any files whose
56characteristics do not match those of the specification, or which are
57missing from either the specification or the tree.
58.Pp
59The options are as follows:
60.Bl -tag -width flag
61.It Fl c
62Print a specification for the tree to standard output.
63.It Fl d
64Ignore everything except directory type files.
65.It Fl e
66Don't object to files that are in the tree but not in the specification.
67.It Fl f
68Read the specification from
69.Ar file ,
70instead of from standard input.
71.It Fl p
72Traverse the tree rooted in
73.Ar path ,
74instead of the current directory.
75.It Fl r
76Remove any files in the tree that are not described in the
77specification.
78.It Fl u
79Modify the owner, group, and permissions of existing files to match
80the specification, as well as create any missing directories.
81Owner, group, and permissions must all be specified for missing
82directories to be created.
83.It Fl x
84Don't descend below any mount points.
85.El
86.Pp
87Specifications are mostly composed of ``keywords'', i.e. strings that
88that specify values relating to files.
89No keywords have default values, and if a keyword has no set value no
90checks based on it are performed.
91.Pp
92Currently supported keywords are as follows:
93.Bl -tag -width Cm
94.It Cm cksum
95The checksum of the file using the algorithm specified by
96the program
97.Xr cksum 1 .
98.It Cm ignore
99Causes the hierarchy below the file to be ignored.
100.It Cm group
101The group of the file; may be either numeric or symbolic.
102.It Cm mode
103The current file's permissions as an absolute (octal) or symbolic
104value (see
105.Xr chmod 1 ) .
106.It Cm nlink
107The number of hard links the file is expected to have.
108.It Cm owner
109The owner of the file; may be either numeric or symbolic.
110.It Cm size
111The size, in bytes, of the file.
112.It Cm link
113The file a symbolic link is expected to reference.
114.It Cm time
115The last modification time of the file.
116.It Cm type
117The type of the file; may be set to any one of the following:
118.Bl -tag -width Cm -compact
119.It Cm block
120block special device
121.It Cm char
122character special device
123.It Cm dir
124directory
125.It Cm fifo
126fifo
127.It Cm file
128regular file
129.It Cm link
130symbolic link
131.It Cm socket
132socket
133.El
134.El
135.Pp
136There are four types of lines in a specification.
137.Pp
138The first type of line sets a ``global'' value for a keyword, and
139consists of a leading ``/set'' followed by whitespace, followed by
140sets of keyword/value pairs, separated by whitespace.
141Keyword/value pairs consist of a keyword, followed by a equals sign
142(``=''), followed by a value, without intervening whitespace.
143Once a keyword has been set, its value remains unchanged until either
144set again or unset.
145.Pp
146The second type of line unsets keywords and consists of a leading
147``/unset'', followed by whitespace, followed by one or more keywords,
148separated by whitespace.
149.Pp
150The third type of line is a file specification and consists of a file
151name, followed by whitespace, followed by zero or more whitespace
152separated keyword/value pairs.
153The file name may be preceded by any number of whitespace characters.
154The file name may contain any of the standard file name matching
155characters (``['', ``]'', ``?'' or ``*''), in which case files
156in the hierarchy will be associated with the first pattern that
157they match.
158.Pp
159Each of the keyword/value pairs consist of a keyword, followed by an
160equals sign (``=''), followed by the keyword's value, without intervening
161whitespace.
162These values override, without changing, the global value of the
163corresponding keyword.
164.Pp
165All paths are relative.
166Specifying a directory will cause subsequent files to be searched
167for in that directory hierarchy.
168Which brings us to the last type of line in a specification: a line
169containing only the string
170.Dq Nm \&..
171causes the current directory
172path to ascend one level.
173.Pp
174Empty lines and lines whose first non-whitespace character is a hash
175mark (``#'') are ignored.
176.Pp
177.Nm Mtree
178exits with a status of 0 on success and >0 if an error occurred or the
179tree did not match the specification.
180.Sh FILES
181.Bl -tag -width /etc/mtree -compact
182.It Pa /etc/mtree
183system specification directory
184.El
185.Sh SEE ALSO
186.Xr chmod 1 ,
187.Xr chown 1 ,
188.Xr chgrp 1 ,
189.Xr cksum 1 ,
190.Xr find 1 ,
191.Xr stat 2 ,
192.Xr fts 3 ,
193.Xr mkproto 8
194.Sh BUGS
195The
196.Cm cksum
197keyword is not yet implemented.
198.Pp
199The
200.Cm time
201keyword should be specifiable in human readable terms.
202.Sh EXAMPLE
203.Bd -literal -offset indent -compact
204# fs: /a/staff/rick/mybin
205# by: rick
206# date: Fri May 25 12:26:57 1990
207
208/set group=staff mode=0555 nlink=1 owner=rick type=file
209[ nlink=2 size=6144
210adb size=53248
211df group=operator mode=02555 size=20480
212ps group=kmem mode=02555 size=54272
213rcp owner=root mode=04555 size=79872
214test nlink=2 size=6144
215
216/set group=wheel mode=0444 nlink=1 owner=rick type=file
217manpages type=dir mode=0775 nlink=2 size=1024
218adb.man size=9473
219df.man size=5263
220tar.man size=3324
221\&..
222.Ed
223.Sh HISTORY
224The
225.Nm mtree
226utility appeared in
227.Bx 4.3 Reno .