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