xref: /openbsd/usr.bin/xinstall/install.1 (revision db3296cf)
1.\"	$OpenBSD: install.1,v 1.19 2003/06/10 09:12:13 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 June 6, 1993
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 bCcpSs
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 file1 file2
48.Nm install
49.Op Fl bCcpSs
50.Op Fl B Ar suffix
51.Op Fl f Ar flags
52.Op Fl g Ar group
53.Op Fl m Ar mode
54.Op Fl o Ar owner
55.Ar file1
56\&...
57.Ar fileN directory
58.Nm install
59.Fl d
60.Op Fl g Ar group
61.Op Fl m Ar mode
62.Op Fl o Ar owner
63.Ar directory
64\&...
65.Sh DESCRIPTION
66The file(s) are moved (or copied if the
67.Fl c
68option is specified) to the target file or directory.
69If the destination is a directory, then the
70.Ar file
71is moved into
72.Ar directory
73with its original filename.
74If the target file already exists, it is
75either renamed to
76.Ar file.old
77if the
78.Fl b
79option is given
80or overwritten
81if permissions allow, An alternate backup suffix may be specified via the
82.Fl B
83option's argument.
84.Pp
85The options are as follows:
86.Bl -tag -width Ds
87.It Fl b
88Backup any existing files before overwriting them by renaming
89them to
90.Ar file.old .
91See
92.Fl B
93for specifying a different backup suffix.
94.It Fl B Ar suffix
95Use
96.Ar suffix
97as the backup suffix if
98.Fl b
99is given.
100.It Fl C
101Copy the file.
102If the target file already exists and the files are the same,
103then don't change the modification time of the target.
104.It Fl c
105Copy the file.
106This is actually the default.
107The
108.Fl c
109option is only included for backwards compatibility.
110.It Fl d
111Create directories.
112Missing parent directories are created as required.
113.It Fl f
114Specify the target's file flags.
115(See
116.Xr chflags 1
117for a list of possible flags and their meanings.)
118.It Fl g
119Specify a group.
120A numeric GID is allowed.
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 modification time.
132Copy the file, as if the
133.Fl C
134(compare and copy) option is specified,
135except if the target file doesn't already exist or is different,
136then preserve the modification time of the 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.Pa /usr/bin/strip
152to strip binaries so that install can be portable over a large
153number of systems and binary types.
154If the environment variable
155.Ev STRIP
156is set, it is used instead.
157.El
158.Pp
159By default,
160.Nm
161preserves all file flags, with the exception of the
162.Dq nodump
163flag.
164.Pp
165The
166.Nm
167utility attempts to prevent moving a file onto itself.
168.Pp
169Installing
170.Pa /dev/null
171creates an empty file.
172.Pp
173Upon successful completion a value of 0 is returned.
174Otherwise, a value >0 is returned.
175.Sh ENVIRONMENT
176.Bl -tag -width "STRIP"
177.It Ev STRIP
178For an alternate
179.Xr strip 1
180program to run.
181Default is
182.Pa /usr/bin/strip .
183.El
184.Sh FILES
185.Bl -tag -width INS@XXXXXX -compact
186.It Pa INS@XXXXXX
187If either
188.Fl S
189option is specified, or the
190.Fl C
191or
192.Fl p
193option is used in conjunction with the
194.Fl s
195option, temporary files named INS@XXXXXX,
196where XXXXXX is decided by
197.Xr mkstemp 3 ,
198are created in the target directory.
199.El
200.Sh SEE ALSO
201.Xr chflags 1 ,
202.Xr chgrp 1 ,
203.Xr chmod 1 ,
204.Xr cp 1 ,
205.Xr mv 1 ,
206.Xr strip 1 ,
207.Xr chown 8
208.Sh HISTORY
209The
210.Nm
211utility appeared in
212.Bx 4.2 .
213.Sh CAVEATS
214The
215.Fl C ,
216.Fl p ,
217and
218.Fl S
219flags are non-standard and should not relied upon for portability.
220.Pp
221Temporary files may be left in the target directory if
222.Nm
223exits abnormally.
224