Commit | Line | Data |
---|---|---|
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 | |
46 | The utility | |
47 | .Nm mtree | |
48 | compares a directory hierarchy against a specification for a | |
49 | directory hierarchy. | |
50 | By default, the specification is read from the standard input. | |
51 | .Nm Mtree | |
52 | verifies that the tree rooted in the current directory matches the | |
53 | specification. | |
54 | .Pp | |
55 | Messages are written to standard output for any files whose | |
56 | characteristics do not match those of the specification, or which are | |
57 | missing from either the specification or the tree. | |
58 | .Pp | |
59 | The options are as follows: | |
60 | .Bl -tag -width flag | |
61 | .It Fl c | |
62 | Print a specification for the tree to standard output. | |
63 | .It Fl d | |
64 | Ignore everything except directory type files. | |
65 | .It Fl e | |
66 | Don't object to files that are in the tree but not in the specification. | |
67 | .It Fl f | |
68 | Read the specification from | |
69 | .Ar file , | |
70 | instead of from standard input. | |
71 | .It Fl p | |
72 | Traverse the tree rooted in | |
73 | .Ar path , | |
74 | instead of the current directory. | |
75 | .It Fl r | |
76 | Remove any files in the tree that are not described in the | |
77 | specification. | |
78 | .It Fl u | |
79 | Modify the owner, group, and permissions of existing files to match | |
80 | the specification, as well as create any missing directories. | |
81 | Owner, group, and permissions must all be specified for missing | |
82 | directories to be created. | |
83 | .It Fl x | |
84 | Don't descend below any mount points. | |
85 | .El | |
86 | .Pp | |
87 | Specifications are mostly composed of ``keywords'', i.e. strings that | |
88 | that specify values relating to files. | |
89 | No keywords have default values, and if a keyword has no set value no | |
90 | checks based on it are performed. | |
91 | .Pp | |
92 | Currently supported keywords are as follows: | |
93 | .Bl -tag -width Cm | |
94 | .It Cm cksum | |
95 | The checksum of the file using the algorithm specified by | |
96 | the program | |
97 | .Xr cksum 1 . | |
98 | .It Cm ignore | |
99 | Causes the hierarchy below the file to be ignored. | |
100 | .It Cm group | |
101 | The group of the file; may be either numeric or symbolic. | |
102 | .It Cm mode | |
103 | The current file's permissions as an absolute (octal) or symbolic | |
104 | value (see | |
105 | .Xr chmod 1 ) . | |
106 | .It Cm nlink | |
107 | The number of hard links the file is expected to have. | |
108 | .It Cm owner | |
109 | The owner of the file; may be either numeric or symbolic. | |
110 | .It Cm size | |
111 | The size, in bytes, of the file. | |
112 | .It Cm link | |
113 | The file a symbolic link is expected to reference. | |
114 | .It Cm time | |
115 | The last modification time of the file. | |
116 | .It Cm type | |
117 | The type of the file; may be set to any one of the following: | |
118 | .Bl -tag -width Cm -compact | |
119 | .It Cm block | |
120 | block special device | |
121 | .It Cm char | |
122 | character special device | |
123 | .It Cm dir | |
124 | directory | |
125 | .It Cm fifo | |
126 | fifo | |
127 | .It Cm file | |
128 | regular file | |
129 | .It Cm link | |
130 | symbolic link | |
131 | .It Cm socket | |
132 | socket | |
133 | .El | |
134 | .El | |
135 | .Pp | |
136 | There are four types of lines in a specification. | |
137 | .Pp | |
138 | The first type of line sets a ``global'' value for a keyword, and | |
139 | consists of a leading ``/set'' followed by whitespace, followed by | |
140 | sets of keyword/value pairs, separated by whitespace. | |
141 | Keyword/value pairs consist of a keyword, followed by a equals sign | |
142 | (``=''), followed by a value, without intervening whitespace. | |
143 | Once a keyword has been set, its value remains unchanged until either | |
144 | set again or unset. | |
145 | .Pp | |
146 | The second type of line unsets keywords and consists of a leading | |
147 | ``/unset'', followed by whitespace, followed by one or more keywords, | |
148 | separated by whitespace. | |
149 | .Pp | |
150 | The third type of line is a file specification and consists of a file | |
151 | name, followed by whitespace, followed by zero or more whitespace | |
152 | separated keyword/value pairs. | |
153 | The file name may be preceded by any number of whitespace characters. | |
154 | The file name may contain any of the standard file name matching | |
155 | characters (``['', ``]'', ``?'' or ``*''), in which case files | |
156 | in the hierarchy will be associated with the first pattern that | |
157 | they match. | |
158 | .Pp | |
159 | Each of the keyword/value pairs consist of a keyword, followed by an | |
160 | equals sign (``=''), followed by the keyword's value, without intervening | |
161 | whitespace. | |
162 | These values override, without changing, the global value of the | |
163 | corresponding keyword. | |
164 | .Pp | |
165 | All paths are relative. | |
166 | Specifying a directory will cause subsequent files to be searched | |
167 | for in that directory hierarchy. | |
168 | Which brings us to the last type of line in a specification: a line | |
169 | containing only the string | |
170 | .Dq Nm \&.. | |
171 | causes the current directory | |
172 | path to ascend one level. | |
173 | .Pp | |
174 | Empty lines and lines whose first non-whitespace character is a hash | |
175 | mark (``#'') are ignored. | |
176 | .Pp | |
177 | .Nm Mtree | |
178 | exits with a status of 0 on success and >0 if an error occurred or the | |
179 | tree did not match the specification. | |
180 | .Sh FILES | |
181 | .Bl -tag -width /etc/mtree -compact | |
182 | .It Pa /etc/mtree | |
183 | system 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 | |
195 | The | |
196 | .Cm cksum | |
197 | keyword is not yet implemented. | |
198 | .Pp | |
199 | The | |
200 | .Cm time | |
201 | keyword 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 | |
210 | adb size=53248 | |
211 | df group=operator mode=02555 size=20480 | |
212 | ps group=kmem mode=02555 size=54272 | |
213 | rcp owner=root mode=04555 size=79872 | |
214 | test nlink=2 size=6144 | |
215 | ||
216 | /set group=wheel mode=0444 nlink=1 owner=rick type=file | |
217 | manpages type=dir mode=0775 nlink=2 size=1024 | |
218 | adb.man size=9473 | |
219 | df.man size=5263 | |
220 | tar.man size=3324 | |
221 | \&.. | |
222 | .Ed | |
223 | .Sh HISTORY | |
224 | The | |
225 | .Nm mtree | |
226 | utility appeared in | |
227 | .Bx 4.3 Reno . |