xref: /openbsd/usr.bin/xinstall/install.1 (revision 09467b48)
1.\"	$OpenBSD: install.1,v 1.31 2019/02/08 12:53:44 schwarze 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: February 8 2019 $
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 bCcDdFpSs
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 all leading components of the target before installing into it.
99.It Fl d
100Create directories.
101Missing parent directories are created as required.
102This option cannot be used with the
103.Fl B , b , C , c ,
104.Fl f , p ,
105or
106.Fl s
107options.
108.It Fl F
109Flush the file's contents to disk.
110When copying a file, use the
111.Xr fsync 2
112function to synchronize the installed file's contents with the
113on-disk version.
114.It Fl f Ar flags
115Specify the target's file
116.Ar flags .
117(See
118.Xr chflags 1
119for a list of possible flags and their meanings.)
120.It Fl g Ar group
121Specify a
122.Ar group .
123A numeric GID is allowed.
124.It Fl m Ar mode
125Specify an alternate
126.Ar mode .
127The default mode is set to rwxr-xr-x (0755).
128The specified mode may be either an octal or symbolic value; see
129.Xr chmod 1
130for a description of possible mode values.
131.It Fl o Ar owner
132Specify an
133.Ar owner .
134A numeric UID is allowed.
135.It Fl p
136Preserve the modification time.
137Copy the file, as if the
138.Fl C
139(compare and copy) option is specified,
140except if the target file doesn't already exist or is different,
141then preserve the modification time of the file.
142.It Fl S
143Safe copy.
144This option has no effect and is supported only for compatibility.
145When installing a file, a temporary file is created and written first
146in the destination directory, then atomically renamed.
147This avoids both race conditions and the destruction of existing
148files in case of write failures.
149.It Fl s
150.Nm
151exec's the command
152.Pa /usr/bin/strip
153to strip binaries so that install can be portable over a large
154number of systems and binary types.
155If the environment variable
156.Ev STRIP
157is set, it is used instead.
158.El
159.Pp
160By default,
161.Nm
162preserves all file flags, with the exception of the
163.Dq nodump
164flag.
165.Pp
166The
167.Nm
168utility attempts to prevent moving a file onto itself.
169.Pp
170Installing
171.Pa /dev/null
172creates an empty file.
173.Sh ENVIRONMENT
174.Bl -tag -width "STRIP"
175.It Ev STRIP
176For an alternate
177.Xr strip 1
178program to run.
179Default is
180.Pa /usr/bin/strip .
181.El
182.Sh FILES
183.Bl -tag -width INS@XXXXXXXXXX -compact
184.It Pa INS@XXXXXXXXXX
185Temporary files created in the target directory by
186.Xr mkstemp 3 .
187.El
188.Sh EXIT STATUS
189.Ex -std install
190.Sh SEE ALSO
191.Xr chflags 1 ,
192.Xr chgrp 1 ,
193.Xr chmod 1 ,
194.Xr cp 1 ,
195.Xr mv 1 ,
196.Xr strip 1 ,
197.Xr chown 8
198.Sh HISTORY
199The
200.Nm
201utility appeared in
202.Bx 4.2 .
203.Sh CAVEATS
204The
205.Fl C ,
206.Fl D ,
207.Fl F ,
208.Fl p ,
209and
210.Fl S
211flags are non-standard and should not be relied upon for portability.
212.Pp
213Temporary files may be left in the target directory if
214.Nm
215exits abnormally.
216