xref: /freebsd/usr.bin/xinstall/install.1 (revision 99e8005137088aafb1350e23b113d69b01b0820f)
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$
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
58\&...
59.Ar fileN directory
60.Nm
61.Fl d
62.Op Fl v
63.Op Fl g Ar group
64.Op Fl m Ar mode
65.Op Fl o Ar owner
66.Ar directory
67\&...
68.Sh DESCRIPTION
69The file(s) are moved (or copied if the
70.Fl c
71option is specified) to the target file or directory.
72If the destination is a directory, then the
73.Ar file
74is moved into
75.Ar directory
76with its original filename.
77If the target file already exists, it is
78either renamed to
79.Ar file Ns Pa .old
80if the
81.Fl b
82option is given
83or overwritten
84if permissions allow.
85An alternate backup suffix may be specified via the
86.Fl B
87option's argument.
88.Pp
89The options are as follows:
90.Bl -tag -width indent
91.It Fl b
92Back up any existing files before overwriting them by renaming
93them to
94.Ar file Ns Pa .old .
95See
96.Fl B
97for specifying a different backup suffix.
98.It Fl B Ar suffix
99Use
100.Ar suffix
101as the backup suffix if
102.Fl b
103is given.
104.It Fl C
105Copy the file.
106If the target file already exists and the files are the same,
107then don't change the modification time of the target.
108.It Fl c
109Copy the file.
110This is actually the default.
111The
112.Fl c
113option is only included for backwards compatibility.
114.It Fl d
115Create directories.
116Missing parent directories are created as required.
117.It Fl f
118Specify the target's file flags; see
119.Xr chflags 1
120for a list of possible flags and their meanings.
121.It Fl g
122Specify a group.
123A numeric GID is allowed.
124.It Fl M
125Disable all use of
126.Xr mmap 2 .
127.It Fl m
128Specify an alternate mode.
129The default mode is set to rwxr-xr-x (0755).
130The specified mode may be either an octal or symbolic value; see
131.Xr chmod 1
132for a description of possible mode values.
133.It Fl o
134Specify an owner.
135A numeric UID is allowed.
136.It Fl p
137Preserve the modification time.
138Copy the file, as if the
139.Fl C
140(compare and copy) option is specified,
141except if the target file doesn't already exist or is different,
142then preserve the modification time of the file.
143.It Fl S
144Safe copy.
145Normally,
146.Nm
147unlinks an existing target before installing the new file.
148With the
149.Fl S
150flag a temporary file is used and then renamed to be
151the target.
152The reason this is safer is that if the copy or
153rename fails, the existing target is left untouched.
154.It Fl s
155.Nm
156exec's the command
157.Xr strip 1
158to strip binaries so that
159.Nm
160can be portable over a large
161number of systems and binary types.
162.It Fl v
163Causes
164.Nm
165to show when
166.Fl C
167actually installs something.
168.El
169.Pp
170By default,
171.Nm
172preserves all file flags, with the exception of the
173.Dq nodump
174flag.
175.Pp
176The
177.Nm
178utility attempts to prevent moving a file onto itself.
179.Pp
180Installing
181.Pa /dev/null
182creates an empty file.
183.Sh DIAGNOSTICS
184The
185.Nm
186utility exits 0 on success, and 1 otherwise.
187.Sh FILES
188.Bl -tag -width INS@XXXX -compact
189.It Pa INS@XXXX
190If either
191.Fl S
192option is specified, or the
193.Fl C
194or
195.Fl p
196option is used in conjuction with the
197.Fl s
198option, temporary files named
199.Pa INS@XXXX ,
200where
201.Pa XXXX
202is decided by
203.Xr mkstemp 3 ,
204are created in the target directory.
205.El
206.Sh SEE ALSO
207.Xr chflags 1 ,
208.Xr chgrp 1 ,
209.Xr chmod 1 ,
210.Xr cp 1 ,
211.Xr mv 1 ,
212.Xr strip 1 ,
213.Xr mmap 2 ,
214.Xr chown 8
215.Sh HISTORY
216The
217.Nm
218utility appeared in
219.Bx 4.2 .
220.Sh BUGS
221Temporary files may be left in the target directory if
222.Nm
223exits abnormally.
224.Pp
225File flags cannot be set by
226.Xr fchflags 2
227over a NFS file system.  Other file systems do not have a concept of flags.
228.Nm
229will only warn when flags could not be set on a file system
230that does not support them.
231.Pp
232.Nm
233with
234.Fl v
235falsely says a file is copied when
236.Fl C
237snaps hard links.
238