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