]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - usr.bin/xinstall/install.1
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / usr.bin / xinstall / install.1
1 .\" Copyright (c) 1987, 1990, 1993
2 .\"     The Regents of the University of California.  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 .\" 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.
15 .\"
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
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     From: @(#)install.1     8.1 (Berkeley) 6/6/93
29 .\" $FreeBSD$
30 .\"
31 .Dd January 18, 2013
32 .Dt INSTALL 1
33 .Os
34 .Sh NAME
35 .Nm install
36 .Nd install binaries
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl bCcpSsUv
40 .Op Fl B Ar suffix
41 .Op Fl D Ar destdir
42 .Op Fl f Ar flags
43 .Op Fl g Ar group
44 .Op Fl h Ar hash
45 .Op Fl l Ar linkflags
46 .Op Fl M Ar metalog
47 .Op Fl m Ar mode
48 .Op Fl N Ar dbdir
49 .Op Fl o Ar owner
50 .Op Fl T Ar tags
51 .Ar file1 file2
52 .Nm
53 .Op Fl bCcpSsUv
54 .Op Fl B Ar suffix
55 .Op Fl D Ar destdir
56 .Op Fl f Ar flags
57 .Op Fl g Ar group
58 .Op Fl h Ar hash
59 .Op Fl l Ar linkflags
60 .Op Fl M Ar metalog
61 .Op Fl m Ar mode
62 .Op Fl N Ar dbdir
63 .Op Fl o Ar owner
64 .Op Fl T Ar tags
65 .Ar file1 ... fileN directory
66 .Nm
67 .Fl d
68 .Op Fl Uv
69 .Op Fl D Ar destdir
70 .Op Fl g Ar group
71 .Op Fl h Ar hash
72 .Op Fl M Ar metalog
73 .Op Fl m Ar mode
74 .Op Fl N Ar dbdir
75 .Op Fl o Ar owner
76 .Op Fl T Ar tags
77 .Ar directory ...
78 .Sh DESCRIPTION
79 The file(s) are copied
80 (or linked if the
81 .Fl l
82 option is specified) to the target file or directory.
83 If the destination is a directory, then the
84 .Ar file
85 is copied into
86 .Ar directory
87 with its original filename.
88 If the target file already exists, it is
89 either renamed to
90 .Ar file Ns Pa .old
91 if the
92 .Fl b
93 option is given
94 or overwritten
95 if permissions allow.
96 An alternate backup suffix may be specified via the
97 .Fl B
98 option's argument.
99 .Pp
100 The options are as follows:
101 .Bl -tag -width indent
102 .It Fl b
103 Back up any existing files before overwriting them by renaming
104 them to
105 .Ar file Ns Pa .old .
106 See
107 .Fl B
108 for specifying a different backup suffix.
109 .It Fl B Ar suffix
110 Use
111 .Ar suffix
112 as the backup suffix if
113 .Fl b
114 is given.
115 .It Fl C
116 Copy the file.
117 If the target file already exists and the files are the same,
118 then do not change the modification time of the target.
119 If the target's file flags and mode need not to be changed,
120 the target's inode change time is also unchanged.
121 .It Fl c
122 Copy the file.
123 This is actually the default.
124 The
125 .Fl c
126 option is only included for backwards compatibility.
127 .It Fl D Ar destdir
128 Specify the
129 .Ev DESTDIR
130 (top of the file hierarchy) that the items are installed in to.
131 If
132 .Fl M Ar metalog
133 is in use, a leading string of
134 .Dq Ar destdir
135 will be removed from the file names logged to the
136 .Ar metalog .
137 This option does not affect where the actual files are installed.
138 .It Fl d
139 Create directories.
140 Missing parent directories are created as required.
141 .It Fl f
142 Specify the target's file flags; see
143 .Xr chflags 1
144 for a list of possible flags and their meanings.
145 .It Fl g
146 Specify a group.
147 A numeric GID is allowed.
148 .It Fl h Ar hash
149 When copying, calculate the digest of the files with
150 .Ar hash
151 to store in the
152 .Fl M Ar metalog .
153 When
154 .Fl d
155 is given no hash is emitted.
156 Supported digests:
157 .Bl -tag -width rmd160 -offset indent
158 .It Sy none
159 No hash.
160 This is the default.
161 .It Sy md5
162 The MD5 cryptographic message digest.
163 .It Sy rmd160
164 The RMD-160 cryptographic message digest.
165 .It Sy sha1
166 The SHA-1 cryptographic message digest.
167 .It Sy sha256
168 The 256-bits
169 .Tn SHA-2
170 cryptographic message digest of the file.
171 .It Sy sha512
172 The 512-bits
173 .Tn SHA-2
174 cryptographic message digest of the file.
175 .El
176 .It Fl l Ar linkflags
177 Instead of copying the file make a link to the source.
178 The type of the link is determined by the
179 .Ar linkflags
180 argument.
181 Valid
182 .Ar linkflags
183 are:
184 .Ar a
185 (absolute),
186 .Ar r
187 (relative),
188 .Ar h
189 (hard),
190 .Ar s
191 (symbolic),
192 .Ar m
193 (mixed).
194 Absolute and relative have effect only for symbolic links.
195 Mixed links
196 are hard links for files on the same filesystem, symbolic otherwise.
197 .It Fl M Ar metalog
198 Write the metadata associated with each item installed to
199 .Ar metalog
200 in an
201 .Xr mtree 8
202 .Dq full path
203 specification line.
204 The metadata includes: the file name and file type, and depending upon
205 other options, the owner, group, file flags, modification time, and tags.
206 .It Fl m
207 Specify an alternate mode.
208 The default mode is set to rwxr-xr-x (0755).
209 The specified mode may be either an octal or symbolic value; see
210 .Xr chmod 1
211 for a description of possible mode values.
212 .It Fl N
213 Use the user database text file
214 .Pa master.passwd
215 and group database text file
216 .Pa group
217 from
218 .Ar dbdir ,
219 rather than using the results from the system's
220 .Xr getpwnam 3
221 and
222 .Xr getgrnam 3
223 (and related) library calls.
224 .It Fl o
225 Specify an owner.
226 A numeric UID is allowed.
227 .It Fl p
228 Preserve the access and modification times.
229 Copy the file, as if the
230 .Fl C
231 (compare and copy) option is specified,
232 except if the target file does not already exist or is different,
233 then preserve the access and modification times of the source file.
234 .It Fl S
235 Safe copy.
236 Normally,
237 .Nm
238 unlinks an existing target before installing the new file.
239 With the
240 .Fl S
241 flag a temporary file is used and then renamed to be
242 the target.
243 The reason this is safer is that if the copy or
244 rename fails, the existing target is left untouched.
245 .It Fl s
246 .Nm
247 exec's the command
248 .Xr strip 1
249 to strip binaries so that
250 .Nm
251 can be portable over a large
252 number of systems and binary types.
253 See below for how
254 .Nm
255 can be instructed to use another program to strip binaries.
256 .It Fl T Ar tags
257 Specify the
258 .Xr mtree 8
259 tags to write out for the file when using
260 .Fl M Ar metalog .
261 .It Fl U
262 Indicate that install is running unprivileged, and that it should not
263 try to change the owner, the group, or the file flags of the destination.
264 The information that would have been updated can be stored in a log
265 file with
266 .Fl M Ar metalog .
267 .It Fl v
268 Cause
269 .Nm
270 to be verbose,
271 showing files as they are installed or backed up.
272 .El
273 .Pp
274 By default,
275 .Nm
276 preserves all file flags, with the exception of the
277 .Dq nodump
278 flag.
279 .Pp
280 The
281 .Nm
282 utility attempts to prevent moving a file onto itself.
283 .Pp
284 Installing
285 .Pa /dev/null
286 creates an empty file.
287 .Sh ENVIRONMENT
288 The
289 .Nm
290 utility checks for the presence of the
291 .Ev STRIPBIN
292 environment variable and if present,
293 uses the assigned value as the program to run if and when the
294 .Fl s
295 option has been specified.
296 .Pp
297 If the
298 .Ev DONTSTRIP
299 environment variable is present,
300 .Nm
301 will ignore any specification of the
302 .Fl s
303 option.
304 This is mainly for use in debugging the
305 .Fx
306 Ports Collection.
307 .Sh FILES
308 .Bl -tag -width ".Pa INS@XXXX" -compact
309 .It Pa INS@XXXX
310 If either
311 .Fl S
312 option is specified, or the
313 .Fl C
314 or
315 .Fl p
316 option is used in conjunction with the
317 .Fl s
318 option, temporary files named
319 .Pa INS@XXXX ,
320 where
321 .Pa XXXX
322 is decided by
323 .Xr mkstemp 3 ,
324 are created in the target directory.
325 .El
326 .Sh EXIT STATUS
327 .Ex -std
328 .Sh COMPATIBILITY
329 Historically
330 .Nm
331 moved files by default.
332 The default was changed to copy in
333 .Fx 4.4 .
334 .Sh SEE ALSO
335 .Xr chflags 1 ,
336 .Xr chgrp 1 ,
337 .Xr chmod 1 ,
338 .Xr cp 1 ,
339 .Xr mv 1 ,
340 .Xr strip 1 ,
341 .Xr mmap 2 ,
342 .Xr getgrnam 3 ,
343 .Xr getpwnam 3 ,
344 .Xr chown 8
345 .Sh HISTORY
346 The
347 .Nm
348 utility appeared in
349 .Bx 4.2 .
350 .Sh BUGS
351 The meaning of the
352 .Fl M
353 option has changed as of
354 .Fx 9.2
355 and it now takes an argument.
356 Command lines that used the old
357 .Fl M
358 will get an error or in rare cases will append logs to the first of
359 multiple source files rather than installing it.
360 .Pp
361 Temporary files may be left in the target directory if
362 .Nm
363 exits abnormally.
364 .Pp
365 File flags cannot be set by
366 .Xr fchflags 2
367 over a NFS file system.
368 Other file systems do not have a concept of flags.
369 The
370 .Nm
371 utility will only warn when flags could not be set on a file system
372 that does not support them.
373 .Pp
374 The
375 .Nm
376 utility with
377 .Fl v
378 falsely says a file is copied when
379 .Fl C
380 snaps hard links.