xref: /freebsd/usr.bin/xinstall/install.1 (revision aa77200569e397d6ff1fdb4d255d0fa254d0a128)
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.\" 4. 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 March 6, 2006
32.Dt INSTALL 1
33.Os
34.Sh NAME
35.Nm install
36.Nd install binaries
37.Sh SYNOPSIS
38.Nm
39.Op Fl bCcMpSsv
40.Op Fl B Ar suffix
41.Op Fl f Ar flags
42.Op Fl g Ar group
43.Op Fl m Ar mode
44.Op Fl o Ar owner
45.Ar file1 file2
46.Nm
47.Op Fl bCcMpSsv
48.Op Fl B Ar suffix
49.Op Fl f Ar flags
50.Op Fl g Ar group
51.Op Fl m Ar mode
52.Op Fl o Ar owner
53.Ar file1 ... fileN directory
54.Nm
55.Fl d
56.Op Fl v
57.Op Fl g Ar group
58.Op Fl m Ar mode
59.Op Fl o Ar owner
60.Ar directory ...
61.Sh DESCRIPTION
62The file(s) are copied
63to the target file or directory.
64If the destination is a directory, then the
65.Ar file
66is copied into
67.Ar directory
68with its original filename.
69If the target file already exists, it is
70either renamed to
71.Ar file Ns Pa .old
72if the
73.Fl b
74option is given
75or overwritten
76if permissions allow.
77An alternate backup suffix may be specified via the
78.Fl B
79option's argument.
80.Pp
81The options are as follows:
82.Bl -tag -width indent
83.It Fl b
84Back up any existing files before overwriting them by renaming
85them to
86.Ar file Ns Pa .old .
87See
88.Fl B
89for specifying a different backup suffix.
90.It Fl B Ar suffix
91Use
92.Ar suffix
93as the backup suffix if
94.Fl b
95is given.
96.It Fl C
97Copy the file.
98If the target file already exists and the files are the same,
99then do not change the modification time of the target.
100If the target's file flags and mode need not to be changed,
101the target's inode change time is also unchanged.
102.It Fl c
103Copy the file.
104This is actually the default.
105The
106.Fl c
107option is only included for backwards compatibility.
108.It Fl d
109Create directories.
110Missing parent directories are created as required.
111.It Fl f
112Specify the target's file flags; see
113.Xr chflags 1
114for a list of possible flags and their meanings.
115.It Fl g
116Specify a group.
117A numeric GID is allowed.
118.It Fl M
119Disable all use of
120.Xr mmap 2 .
121.It Fl m
122Specify an alternate mode.
123The default mode is set to rwxr-xr-x (0755).
124The specified mode may be either an octal or symbolic value; see
125.Xr chmod 1
126for a description of possible mode values.
127.It Fl o
128Specify an owner.
129A numeric UID is allowed.
130.It Fl p
131Preserve the access and modification times.
132Copy the file, as if the
133.Fl C
134(compare and copy) option is specified,
135except if the target file does not already exist or is different,
136then preserve the access and modification times of the source file.
137.It Fl S
138Safe copy.
139Normally,
140.Nm
141unlinks an existing target before installing the new file.
142With the
143.Fl S
144flag a temporary file is used and then renamed to be
145the target.
146The reason this is safer is that if the copy or
147rename fails, the existing target is left untouched.
148.It Fl s
149.Nm
150exec's the command
151.Xr strip 1
152to strip binaries so that
153.Nm
154can be portable over a large
155number of systems and binary types.
156See below for how
157.Nm
158can be instructed to use another program to strip binaries.
159.It Fl v
160Cause
161.Nm
162to be verbose,
163showing files as they are installed or backed up.
164.El
165.Pp
166By default,
167.Nm
168preserves all file flags, with the exception of the
169.Dq nodump
170flag.
171.Pp
172The
173.Nm
174utility attempts to prevent moving a file onto itself.
175.Pp
176Installing
177.Pa /dev/null
178creates an empty file.
179.Sh ENVIRONMENT
180The
181.Nm
182utility checks for the presence of the
183.Ev STRIPBIN
184environment variable and if present,
185uses the assigned value as the program to run if and when the
186.Fl s
187option has been specified.
188.Pp
189If the
190.Ev DONTSTRIP
191environment variable is present,
192.Nm
193will ignore any specification of the
194.Fl s
195option.
196This is mainly for use in debugging the
197.Fx
198Ports Collection.
199.Sh FILES
200.Bl -tag -width ".Pa INS@XXXX" -compact
201.It Pa INS@XXXX
202If either
203.Fl S
204option is specified, or the
205.Fl C
206or
207.Fl p
208option is used in conjunction with the
209.Fl s
210option, temporary files named
211.Pa INS@XXXX ,
212where
213.Pa XXXX
214is decided by
215.Xr mkstemp 3 ,
216are created in the target directory.
217.El
218.Sh EXIT STATUS
219.Ex -std
220.Sh COMPATIBILITY
221Historically
222.Nm
223moved files by default.
224The default was changed to copy in
225.Fx 4.4 .
226.Sh SEE ALSO
227.Xr chflags 1 ,
228.Xr chgrp 1 ,
229.Xr chmod 1 ,
230.Xr cp 1 ,
231.Xr mv 1 ,
232.Xr strip 1 ,
233.Xr mmap 2 ,
234.Xr chown 8
235.Sh HISTORY
236The
237.Nm
238utility appeared in
239.Bx 4.2 .
240.Sh BUGS
241Temporary files may be left in the target directory if
242.Nm
243exits abnormally.
244.Pp
245File flags cannot be set by
246.Xr fchflags 2
247over a NFS file system.
248Other file systems do not have a concept of flags.
249The
250.Nm
251utility will only warn when flags could not be set on a file system
252that does not support them.
253.Pp
254The
255.Nm
256utility with
257.Fl v
258falsely says a file is copied when
259.Fl C
260snaps hard links.
261