file_cmds-60.tar.gz
[apple/file_cmds.git] / install / 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. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     From: @(#)install.1     8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD: src/usr.bin/xinstall/install.1,v 1.21 2001/05/30 09:45:47 ru Exp $
34 .\"
35 .Dd May 7, 2001
36 .Dt INSTALL 1
37 .Os
38 .Sh NAME
39 .Nm install
40 .Nd install binaries
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl bCcMpSsv
44 .Op Fl B Ar suffix
45 .Op Fl f Ar flags
46 .Op Fl g Ar group
47 .Op Fl m Ar mode
48 .Op Fl o Ar owner
49 .Ar file1 file2
50 .Nm
51 .Op Fl bCcMpSsv
52 .Op Fl B Ar suffix
53 .Op Fl f Ar flags
54 .Op Fl g Ar group
55 .Op Fl m Ar mode
56 .Op Fl o Ar owner
57 .Ar file1 ... fileN directory
58 .Nm
59 .Fl d
60 .Op Fl v
61 .Op Fl g Ar group
62 .Op Fl m Ar mode
63 .Op Fl o Ar owner
64 .Ar directory ...
65 .Sh DESCRIPTION
66 The file(s) are copied
67 to the target file or directory.
68 If the destination is a directory, then the
69 .Ar file
70 is copied into
71 .Ar directory
72 with its original filename.
73 If the target file already exists, it is
74 either renamed to
75 .Ar file Ns Pa .old
76 if the
77 .Fl b
78 option is given
79 or overwritten
80 if permissions allow.
81 An alternate backup suffix may be specified via the
82 .Fl B
83 option's argument.
84 .Pp
85 The options are as follows:
86 .Bl -tag -width indent
87 .It Fl b
88 Back up any existing files before overwriting them by renaming
89 them to
90 .Ar file Ns Pa .old .
91 See
92 .Fl B
93 for specifying a different backup suffix.
94 .It Fl B Ar suffix
95 Use
96 .Ar suffix
97 as the backup suffix if
98 .Fl b
99 is given.
100 .It Fl C
101 Copy the file.
102 If the target file already exists and the files are the same,
103 then don't change the modification time of the target.
104 .It Fl c
105 Copy the file.
106 This is actually the default.
107 The
108 .Fl c
109 option is only included for backwards compatibility.
110 .It Fl d
111 Create directories.
112 Missing parent directories are created as required.
113 .It Fl f
114 Specify the target's file flags; see
115 .Xr chflags 1
116 for a list of possible flags and their meanings.
117 .It Fl g
118 Specify a group.
119 A numeric GID is allowed.
120 .It Fl M
121 Disable all use of
122 .Xr mmap 2 .
123 .It Fl m
124 Specify an alternate mode.
125 The default mode is set to rwxr-xr-x (0755).
126 The specified mode may be either an octal or symbolic value; see
127 .Xr chmod 1
128 for a description of possible mode values.
129 .It Fl o
130 Specify an owner.
131 A numeric UID is allowed.
132 .It Fl p
133 Preserve the modification time.
134 Copy the file, as if the
135 .Fl C
136 (compare and copy) option is specified,
137 except if the target file doesn't already exist or is different,
138 then preserve the modification time of the file.
139 .It Fl S
140 Safe copy.
141 Normally,
142 .Nm
143 unlinks an existing target before installing the new file.
144 With the
145 .Fl S
146 flag a temporary file is used and then renamed to be
147 the target.
148 The reason this is safer is that if the copy or
149 rename fails, the existing target is left untouched.
150 .It Fl s
151 .Nm
152 exec's the command
153 .Xr strip 1
154 to strip binaries so that
155 .Nm
156 can be portable over a large
157 number of systems and binary types.
158 .It Fl v
159 Causes
160 .Nm
161 to show when
162 .Fl C
163 actually installs something.
164 .El
165 .Pp
166 By default,
167 .Nm
168 preserves all file flags, with the exception of the
169 .Dq nodump
170 flag.
171 .Pp
172 The
173 .Nm
174 utility attempts to prevent moving a file onto itself.
175 .Pp
176 Installing
177 .Pa /dev/null
178 creates an empty file.
179 .Sh DIAGNOSTICS
180 The
181 .Nm
182 utility exits 0 on success, and 1 otherwise.
183 .Sh FILES
184 .Bl -tag -width INS@XXXX -compact
185 .It Pa INS@XXXX
186 If either
187 .Fl S
188 option is specified, or the
189 .Fl C
190 or
191 .Fl p
192 option is used in conjuction with the
193 .Fl s
194 option, temporary files named
195 .Pa INS@XXXX ,
196 where
197 .Pa XXXX
198 is decided by
199 .Xr mkstemp 3 ,
200 are created in the target directory.
201 .El
202 .Sh COMPATIBILITY
203 Historically
204 .Nm
205 moved files by default.
206 The default was changed to copy in
207 .Fx 4.4 .
208 .Sh SEE ALSO
209 .Xr chflags 1 ,
210 .Xr chgrp 1 ,
211 .Xr chmod 1 ,
212 .Xr cp 1 ,
213 .Xr mv 1 ,
214 .Xr strip 1 ,
215 .Xr mmap 2 ,
216 .Xr chown 8
217 .Sh HISTORY
218 The
219 .Nm
220 utility appeared in
221 .Bx 4.2 .
222 .Sh BUGS
223 Temporary files may be left in the target directory if
224 .Nm
225 exits abnormally.
226 .Pp
227 File flags cannot be set by
228 .Xr fchflags 2
229 over a NFS file system.  Other file systems do not have a concept of flags.
230 .Nm
231 will only warn when flags could not be set on a file system
232 that does not support them.
233 .Pp
234 .Nm
235 with
236 .Fl v
237 falsely says a file is copied when
238 .Fl C
239 snaps hard links.