Commit | Line | Data |
---|---|---|
b5dc1377 | 1 | .\" Copyright (c) 1989, 1990 The Regents of the University of California. |
25f14064 KB |
2 | .\" All rights reserved. |
3 | .\" | |
804e6434 | 4 | .\" %sccs.include.redist.roff% |
25f14064 | 5 | .\" |
8d03b40e | 6 | .\" @(#)mtree.8 5.10 (Berkeley) %G% |
25f14064 | 7 | .\" |
b5dc1377 CL |
8 | .Dd |
9 | .Dt MTREE 8 | |
ee9b0a0a | 10 | .Os |
b5dc1377 CL |
11 | .Sh NAME |
12 | .Nm mtree | |
13 | .Nd map a directory hierarchy | |
14 | .Sh SYNOPSIS | |
15 | .Nm mtree | |
16 | .Op Fl cderux | |
17 | .Op Fl f Ar spec | |
18 | .Op Fl p Ar path | |
19 | .Sh DESCRIPTION | |
804e6434 CL |
20 | The utility |
21 | .Nm mtree | |
f33455dd KB |
22 | compares a directory hierarchy against a specification for a |
23 | directory hierarchy. | |
24 | By default, the specification is read from the standard input. | |
b5dc1377 | 25 | .Nm Mtree |
f33455dd KB |
26 | verifies that the tree rooted in the current directory matches the |
27 | specification. | |
b5dc1377 | 28 | .Pp |
f33455dd KB |
29 | Messages are written to standard output for any files whose |
30 | characteristics do not match those of the specification, or which are | |
31 | missing from either the specification or the tree. | |
b5dc1377 | 32 | .Pp |
25f14064 | 33 | The options are as follows: |
8d03b40e | 34 | .Bl -tag -width flag |
804e6434 | 35 | .It Fl c |
f33455dd | 36 | Print a specification for the tree to standard output. |
804e6434 | 37 | .It Fl d |
f33455dd | 38 | Ignore everything except directory type files. |
804e6434 | 39 | .It Fl e |
f33455dd | 40 | Don't object to files that are in the tree but not in the specification. |
804e6434 | 41 | .It Fl f |
f33455dd | 42 | Read the specification from |
b5dc1377 | 43 | .Ar file , |
f33455dd | 44 | instead of from standard input. |
804e6434 | 45 | .It Fl p |
f33455dd | 46 | Traverse the tree rooted in |
b5dc1377 | 47 | .Ar path , |
f33455dd | 48 | instead of the current directory. |
804e6434 | 49 | .It Fl r |
f33455dd | 50 | Remove any files in the tree that are not described in the |
25f14064 | 51 | specification. |
804e6434 | 52 | .It Fl u |
f33455dd KB |
53 | Modify the owner, group, and permissions of existing files to match |
54 | the specification, as well as create any missing directories. | |
55 | Owner, group, and permissions must all be specified for missing | |
56 | directories to be created. | |
804e6434 | 57 | .It Fl x |
f33455dd | 58 | Don't descend below any mount points. |
804e6434 | 59 | .El |
b5dc1377 | 60 | .Pp |
f33455dd KB |
61 | Specifications are mostly composed of ``keywords'', i.e. strings that |
62 | that specify values relating to files. | |
25f14064 | 63 | No keywords have default values, and if a keyword has no set value no |
f33455dd | 64 | checks based on it are performed. |
b5dc1377 | 65 | .Pp |
25f14064 | 66 | Currently supported keywords are as follows: |
804e6434 CL |
67 | .Bl -tag -width Cm |
68 | .It Cm cksum | |
25f14064 KB |
69 | The checksum of the file using the algorithm specified by |
70 | the program | |
b5dc1377 | 71 | .Xr cksum 1 . |
804e6434 | 72 | .It Cm ignore |
f33455dd | 73 | Causes the hierarchy below the file to be ignored. |
804e6434 | 74 | .It Cm group |
f33455dd | 75 | The group of the file; may be either numeric or symbolic. |
804e6434 | 76 | .It Cm mode |
f33455dd KB |
77 | The current file's permissions as an absolute (octal) or symbolic |
78 | value (see | |
b5dc1377 | 79 | .Xr chmod 1 ) . |
804e6434 | 80 | .It Cm nlink |
f33455dd | 81 | The number of hard links the file is expected to have. |
804e6434 | 82 | .It Cm owner |
f33455dd | 83 | The owner of the file; may be either numeric or symbolic. |
804e6434 | 84 | .It Cm size |
f33455dd | 85 | The size, in bytes, of the file. |
804e6434 | 86 | .It Cm link |
25f14064 | 87 | The file a symbolic link is expected to reference. |
804e6434 | 88 | .It Cm time |
0af6fb71 | 89 | The last modification time of the file. |
804e6434 | 90 | .It Cm type |
f33455dd | 91 | The type of the file; may be set to any one of the following: |
8d03b40e | 92 | .Bl -tag -width Cm -compact |
804e6434 | 93 | .It Cm block |
f33455dd | 94 | block special device |
804e6434 | 95 | .It Cm char |
f33455dd | 96 | character special device |
804e6434 | 97 | .It Cm dir |
f33455dd | 98 | directory |
804e6434 | 99 | .It Cm fifo |
f33455dd | 100 | fifo |
804e6434 | 101 | .It Cm file |
f33455dd | 102 | regular file |
804e6434 | 103 | .It Cm link |
f33455dd | 104 | symbolic link |
804e6434 | 105 | .It Cm socket |
f33455dd | 106 | socket |
804e6434 CL |
107 | .El |
108 | .El | |
b5dc1377 | 109 | .Pp |
f33455dd | 110 | There are four types of lines in a specification. |
b5dc1377 | 111 | .Pp |
f33455dd KB |
112 | The first type of line sets a ``global'' value for a keyword, and |
113 | consists of a leading ``/set'' followed by whitespace, followed by | |
114 | sets of keyword/value pairs, separated by whitespace. | |
115 | Keyword/value pairs consist of a keyword, followed by a equals sign | |
116 | (``=''), followed by a value, without intervening whitespace. | |
117 | Once a keyword has been set, its value remains unchanged until either | |
118 | set again or unset. | |
b5dc1377 | 119 | .Pp |
f33455dd KB |
120 | The second type of line unsets keywords and consists of a leading |
121 | ``/unset'', followed by whitespace, followed by one or more keywords, | |
122 | separated by whitespace. | |
b5dc1377 | 123 | .Pp |
f33455dd KB |
124 | The third type of line is a file specification and consists of a file |
125 | name, followed by whitespace, followed by zero or more whitespace | |
126 | separated keyword/value pairs. | |
127 | The file name may be preceded by any number of whitespace characters. | |
128 | The file name may contain any of the standard file name matching | |
129 | characters (``['', ``]'', ``?'' or ``*''), in which case files | |
130 | in the hierarchy will be associated with the first pattern that | |
131 | they match. | |
b5dc1377 | 132 | .Pp |
f33455dd KB |
133 | Each of the keyword/value pairs consist of a keyword, followed by an |
134 | equals sign (``=''), followed by the keyword's value, without intervening | |
135 | whitespace. | |
136 | These values override, without changing, the global value of the | |
25f14064 | 137 | corresponding keyword. |
b5dc1377 | 138 | .Pp |
25f14064 | 139 | All paths are relative. |
f33455dd KB |
140 | Specifying a directory will cause subsequent files to be searched |
141 | for in that directory hierarchy. | |
25f14064 | 142 | Which brings us to the last type of line in a specification: a line |
b5dc1377 CL |
143 | containing only the string |
144 | .Dq Nm \&.. | |
145 | causes the current directory | |
f33455dd | 146 | path to ascend one level. |
b5dc1377 | 147 | .Pp |
f33455dd KB |
148 | Empty lines and lines whose first non-whitespace character is a hash |
149 | mark (``#'') are ignored. | |
b5dc1377 CL |
150 | .Pp |
151 | .Nm Mtree | |
f33455dd KB |
152 | exits with a status of 0 on success and >0 if an error occurred or the |
153 | tree did not match the specification. | |
b5dc1377 | 154 | .Sh FILES |
804e6434 CL |
155 | .Bl -tag -width /etc/mtree -compact |
156 | .It Pa /etc/mtree | |
b5dc1377 | 157 | system specification directory |
804e6434 | 158 | .El |
b5dc1377 CL |
159 | .Sh SEE ALSO |
160 | .Xr chmod 1 , | |
161 | .Xr chown 1 , | |
162 | .Xr chgrp 1 , | |
163 | .Xr cksum 1 , | |
164 | .Xr find 1 , | |
165 | .Xr stat 2 , | |
166 | .Xr fts 3 , | |
167 | .Xr mkproto 8 | |
168 | .Sh BUGS | |
f33455dd | 169 | The |
b5dc1377 | 170 | .Cm cksum |
f33455dd | 171 | keyword is not yet implemented. |
b5dc1377 | 172 | .Pp |
0af6fb71 | 173 | The |
b5dc1377 | 174 | .Cm time |
0af6fb71 | 175 | keyword should be specifiable in human readable terms. |
b5dc1377 | 176 | .Sh EXAMPLE |
804e6434 | 177 | .Bd -literal -offset indent -compact |
f33455dd KB |
178 | # fs: /a/staff/rick/mybin |
179 | # by: rick | |
180 | # date: Fri May 25 12:26:57 1990 | |
804e6434 | 181 | |
f33455dd | 182 | /set group=staff mode=0555 nlink=1 owner=rick type=file |
b5dc1377 | 183 | [ nlink=2 size=6144 |
f33455dd KB |
184 | adb size=53248 |
185 | df group=operator mode=02555 size=20480 | |
186 | ps group=kmem mode=02555 size=54272 | |
187 | rcp owner=root mode=04555 size=79872 | |
188 | test nlink=2 size=6144 | |
804e6434 | 189 | |
f33455dd KB |
190 | /set group=wheel mode=0444 nlink=1 owner=rick type=file |
191 | manpages type=dir mode=0775 nlink=2 size=1024 | |
b5dc1377 CL |
192 | adb.man size=9473 |
193 | df.man size=5263 | |
194 | tar.man size=3324 | |
f33455dd | 195 | \&.. |
804e6434 | 196 | .Ed |
b5dc1377 | 197 | .Sh HISTORY |
804e6434 CL |
198 | The |
199 | .Nm mtree | |
200 | utility appeared in | |
201 | .Bx 4.3 Reno . |