xref: /openbsd/usr.bin/xinstall/install.1 (revision 898184e3)
1.\"	$OpenBSD: install.1,v 1.25 2010/09/29 07:44:57 jmc Exp $
2.\"	$NetBSD: install.1,v 1.4 1994/11/14 04:57:17 jtc Exp $
3.\"
4.\" Copyright (c) 1987, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)install.1	8.1 (Berkeley) 6/6/93
32.\"
33.Dd $Mdocdate: September 29 2010 $
34.Dt INSTALL 1
35.Os
36.Sh NAME
37.Nm install
38.Nd install binaries
39.Sh SYNOPSIS
40.Nm install
41.Op Fl bCcdpSs
42.Op Fl B Ar suffix
43.Op Fl f Ar flags
44.Op Fl g Ar group
45.Op Fl m Ar mode
46.Op Fl o Ar owner
47.Ar source ... target ...
48.Sh DESCRIPTION
49The
50.Ar source
51file(s) are copied to the
52.Ar target
53file or directory.
54If the
55.Ar target
56file already exists, it is either renamed to
57.Ar file.old
58if the
59.Fl b
60option is given
61or overwritten
62if permissions allow.
63An alternate backup suffix may be specified via the
64.Fl B
65option's argument.
66If the
67.Fl d
68option is given,
69.Ar target
70directories are created, and no files are copied.
71.Pp
72The options are as follows:
73.Bl -tag -width "-B suffix"
74.It Fl B Ar suffix
75Use
76.Ar suffix
77as the backup suffix if
78.Fl b
79is given.
80.It Fl b
81Backup any existing files before overwriting them by renaming
82them to
83.Ar file.old .
84See
85.Fl B
86for specifying a different backup suffix.
87.It Fl C
88Copy the file.
89If the target file already exists and the files are the same,
90then don't change the modification time of the target.
91.It Fl c
92Copy the file.
93This is actually the default.
94The
95.Fl c
96option is only included for backwards compatibility.
97.It Fl d
98Create directories.
99Missing parent directories are created as required.
100This option cannot be used with the
101.Fl B , b , C , c ,
102.Fl f , p , S ,
103or
104.Fl s
105options.
106.It Fl f Ar flags
107Specify the target's file
108.Ar flags .
109(See
110.Xr chflags 1
111for a list of possible flags and their meanings.)
112.It Fl g Ar group
113Specify a
114.Ar group .
115A numeric GID is allowed.
116.It Fl m Ar mode
117Specify an alternate
118.Ar mode .
119The default mode is set to rwxr-xr-x (0755).
120The specified mode may be either an octal or symbolic value; see
121.Xr chmod 1
122for a description of possible mode values.
123.It Fl o Ar owner
124Specify an
125.Ar owner .
126A numeric UID is allowed.
127.It Fl p
128Preserve the modification time.
129Copy the file, as if the
130.Fl C
131(compare and copy) option is specified,
132except if the target file doesn't already exist or is different,
133then preserve the modification time of the file.
134.It Fl S
135Safe copy.
136Normally,
137.Nm
138unlinks an existing target before installing the new file.
139With the
140.Fl S
141flag a temporary file is used and then renamed to be
142the target.
143The reason this is safer is that if the copy or
144rename fails, the existing target is left untouched.
145.It Fl s
146.Nm
147exec's the command
148.Pa /usr/bin/strip
149to strip binaries so that install can be portable over a large
150number of systems and binary types.
151If the environment variable
152.Ev STRIP
153is set, it is used instead.
154.El
155.Pp
156By default,
157.Nm
158preserves all file flags, with the exception of the
159.Dq nodump
160flag.
161.Pp
162The
163.Nm
164utility attempts to prevent moving a file onto itself.
165.Pp
166Installing
167.Pa /dev/null
168creates an empty file.
169.Sh ENVIRONMENT
170.Bl -tag -width "STRIP"
171.It Ev STRIP
172For an alternate
173.Xr strip 1
174program to run.
175Default is
176.Pa /usr/bin/strip .
177.El
178.Sh FILES
179.Bl -tag -width INS@XXXXXXXXXX -compact
180.It Pa INS@XXXXXXXXXX
181If either
182.Fl S
183option is specified, or the
184.Fl C
185or
186.Fl p
187option is used in conjunction with the
188.Fl s
189option, temporary files named INS@XXXXXXXXXX,
190where XXXXXXXXXX is decided by
191.Xr mkstemp 3 ,
192are created in the target directory.
193.El
194.Sh EXIT STATUS
195.Ex -std install
196.Sh SEE ALSO
197.Xr chflags 1 ,
198.Xr chgrp 1 ,
199.Xr chmod 1 ,
200.Xr cp 1 ,
201.Xr mv 1 ,
202.Xr strip 1 ,
203.Xr chown 8
204.Sh HISTORY
205The
206.Nm
207utility appeared in
208.Bx 4.2 .
209.Sh CAVEATS
210The
211.Fl C ,
212.Fl p ,
213and
214.Fl S
215flags are non-standard and should not relied upon for portability.
216.Pp
217Temporary files may be left in the target directory if
218.Nm
219exits abnormally.
220