nrelease - fix/improve livecd
[dragonfly.git] / usr.bin / xinstall / install.1
CommitLineData
984263bc
MD
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.
dc71b7ab 12.\" 3. Neither the name of the University nor the names of its contributors
984263bc
MD
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: src/usr.bin/xinstall/install.1,v 1.16.2.9 2002/07/01 21:01:23 des Exp $
30.\"
60af0858 31.Dd January 22, 2016
984263bc
MD
32.Dt INSTALL 1
33.Os
34.Sh NAME
35.Nm install
36.Nd install binaries
37.Sh SYNOPSIS
38.Nm
60af0858 39.Op Fl bCclMpSsUv
984263bc 40.Op Fl B Ar suffix
a2bc4e56 41.Op Fl D Ar destdir
984263bc
MD
42.Op Fl f Ar flags
43.Op Fl g Ar group
a23d58e7 44.Op Fl l Ar linkflags
984263bc 45.Op Fl m Ar mode
4f9e4108 46.Op Fl N Ar dbdir
984263bc
MD
47.Op Fl o Ar owner
48.Ar file1 file2
49.Nm
60af0858 50.Op Fl bCclMpSsUv
984263bc 51.Op Fl B Ar suffix
a2bc4e56 52.Op Fl D Ar destdir
984263bc
MD
53.Op Fl f Ar flags
54.Op Fl g Ar group
a23d58e7 55.Op Fl l Ar linkflags
984263bc 56.Op Fl m Ar mode
4f9e4108 57.Op Fl N Ar dbdir
984263bc
MD
58.Op Fl o Ar owner
59.Ar file1 ... fileN directory
60.Nm
61.Fl d
60af0858 62.Op Fl lUv
4cd7e9fc 63.Op Fl D Ar destdir
984263bc
MD
64.Op Fl g Ar group
65.Op Fl m Ar mode
4f9e4108 66.Op Fl N Ar dbdir
984263bc
MD
67.Op Fl o Ar owner
68.Ar directory ...
69.Sh DESCRIPTION
70The file(s) are copied
a23d58e7
FT
71(or linked if the
72.Fl l
73option is specified) to the target file or directory.
984263bc
MD
74If the destination is a directory, then the
75.Ar file
76is copied into
77.Ar directory
78with its original filename.
79If the target file already exists, it is
80either renamed to
81.Ar file Ns Pa .old
82if the
83.Fl b
84option is given
85or overwritten
86if permissions allow.
87An alternate backup suffix may be specified via the
88.Fl B
89option's argument.
90.Pp
91The options are as follows:
92.Bl -tag -width indent
93.It Fl b
94Back up any existing files before overwriting them by renaming
95them to
96.Ar file Ns Pa .old .
97See
98.Fl B
99for specifying a different backup suffix.
100.It Fl B Ar suffix
101Use
102.Ar suffix
103as the backup suffix if
104.Fl b
105is given.
106.It Fl C
107Copy the file.
108If the target file already exists and the files are the same,
109then don't change the modification time of the target.
110.It Fl c
111Copy the file.
112This is actually the default.
113The
114.Fl c
115option is only included for backwards compatibility.
116.It Fl d
117Create directories.
118Missing parent directories are created as required.
a2bc4e56
FT
119.It Fl D Ar destdir
120Specify the
121.Ev DESTDIR
86a8591e 122(top of the file hierarchy) that the items are installed into.
534c03f0
SW
123This option is implemented for compatibility with the
124.Nx
125version of
4cd7e9fc 126.Nm
a2bc4e56 127and does nothing.
984263bc
MD
128.It Fl f
129Specify the target's file flags; see
130.Xr chflags 1
131for a list of possible flags and their meanings.
132.It Fl g
133Specify a group.
134A numeric GID is allowed.
a23d58e7
FT
135.It Fl l Ar linkflags
136Instead of copying the file make a link to the source.
137The type of the link is determined by the
138.Ar linkflags
139argument.
140Valid
141.Ar linkflags
142are:
143.Ar a
144(absolute),
145.Ar r
146(relative),
147.Ar h
148(hard),
149.Ar s
150(symbolic),
151.Ar m
152(mixed).
153Absolute and relative have effect only for symbolic links.
154Mixed links
155are hard links for files on the same filesystem, symbolic otherwise.
984263bc
MD
156.It Fl M
157Disable all use of
158.Xr mmap 2 .
159.It Fl m
160Specify an alternate mode.
161The default mode is set to rwxr-xr-x (0755).
162The specified mode may be either an octal or symbolic value; see
163.Xr chmod 1
164for a description of possible mode values.
4f9e4108
FT
165.It Fl N
166Use the user database text file
167.Pa master.passwd
168and group database text file
169.Pa group
170from
171.Ar dbdir ,
172rather than using the results from the system's
173.Xr getpwnam 3
174and
175.Xr getgrnam 3
176(and related) library calls.
984263bc
MD
177.It Fl o
178Specify an owner.
179A numeric UID is allowed.
180.It Fl p
181Preserve the modification time.
182Copy the file, as if the
183.Fl C
184(compare and copy) option is specified,
185except if the target file doesn't already exist or is different,
186then preserve the modification time of the file.
187.It Fl S
188Safe copy.
189Normally,
190.Nm
191unlinks an existing target before installing the new file.
192With the
193.Fl S
194flag a temporary file is used and then renamed to be
195the target.
196The reason this is safer is that if the copy or
197rename fails, the existing target is left untouched.
198.It Fl s
199.Nm
200exec's the command
201.Xr strip 1
202to strip binaries so that
203.Nm
204can be portable over a large
205number of systems and binary types.
60af0858 206.It Fl U
207Indicate that
208.Nm
209is running unprivileged, and that it should not try to change
210the owner, the group, or the file flags of the destination.
984263bc
MD
211.It Fl v
212Cause
213.Nm
214to be verbose,
215showing files as they are installed or backed up.
216.El
217.Pp
218By default,
219.Nm
220preserves all file flags, with the exception of the
221.Dq nodump
222flag.
223.Pp
224The
225.Nm
226utility attempts to prevent moving a file onto itself.
227.Pp
228Installing
229.Pa /dev/null
230creates an empty file.
05148599 231.Sh ENVIRONMENT
232The
233.Nm
234utility checks for the presence of the
235.Ev STRIPBIN
236environment variable and if present,
237uses the assigned value as the program to run if and when the
238.Fl s
239option has been specified.
240.Pp
241If the
242.Ev DONTSTRIP
243environment variable is present,
244.Nm
245will ignore any specification of the
246.Fl s
247option.
248This is mainly for use in debugging the
249.Dx
250.Xr dports 7
251collection.
984263bc
MD
252.Sh FILES
253.Bl -tag -width INS@XXXX -compact
254.It Pa INS@XXXX
255If either
256.Fl S
257option is specified, or the
258.Fl C
259or
260.Fl p
3f5e28f4 261option is used in conjunction with the
984263bc
MD
262.Fl s
263option, temporary files named
264.Pa INS@XXXX ,
265where
266.Pa XXXX
267is decided by
268.Xr mkstemp 3 ,
269are created in the target directory.
270.El
19fe1c42 271.Sh EXIT STATUS
1847e88f 272.Ex -std
984263bc
MD
273.Sh COMPATIBILITY
274Historically
275.Nm
276moved files by default.
277The default was changed to copy in
278.Fx 4.4 .
279.Sh SEE ALSO
280.Xr chflags 1 ,
281.Xr chgrp 1 ,
282.Xr chmod 1 ,
283.Xr cp 1 ,
284.Xr mv 1 ,
285.Xr strip 1 ,
286.Xr mmap 2 ,
4f9e4108
FT
287.Xr getgrnam 3 ,
288.Xr getpwnam 3 ,
984263bc
MD
289.Xr chown 8
290.Sh HISTORY
291The
292.Nm
293utility appeared in
294.Bx 4.2 .
295.Sh BUGS
296Temporary files may be left in the target directory if
297.Nm
298exits abnormally.
299.Pp
300File flags cannot be set by
301.Xr fchflags 2
302over a NFS filesystem. Other filesystems do not have a concept of flags.
303The
304.Nm
305utility will only warn when flags could not be set on a filesystem
306that does not support them.
307.Pp
308The
309.Nm
310utility with
311.Fl v
312falsely says a file is copied when
313.Fl C
314snaps hard links.