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