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.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" From: @(#)install.1 8.1 (Berkeley) 6/6/93 33.\" $FreeBSD$ 34.\" 35.Dd March 6, 2006 36.Dt INSTALL 1 37.Os 38.Sh NAME 39.Nm install 40.Nd install binaries 41.Sh SYNOPSIS 42.Nm 43.Op Fl bCcMpSsv 44.Op Fl B Ar suffix 45.Op Fl f Ar flags 46.Op Fl g Ar group 47.Op Fl m Ar mode 48.Op Fl o Ar owner 49.Ar file1 file2 50.Nm 51.Op Fl bCcMpSsv 52.Op Fl B Ar suffix 53.Op Fl f Ar flags 54.Op Fl g Ar group 55.Op Fl m Ar mode 56.Op Fl o Ar owner 57.Ar file1 ... fileN directory 58.Nm 59.Fl d 60.Op Fl v 61.Op Fl g Ar group 62.Op Fl m Ar mode 63.Op Fl o Ar owner 64.Ar directory ... 65.Sh DESCRIPTION 66The file(s) are copied 67to the target file or directory. 68If the destination is a directory, then the 69.Ar file 70is copied into 71.Ar directory 72with its original filename. 73If the target file already exists, it is 74either renamed to 75.Ar file Ns Pa .old 76if the 77.Fl b 78option is given 79or overwritten 80if permissions allow. 81An 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 indent 87.It Fl b 88Back up any existing files before overwriting them by renaming 89them to 90.Ar file Ns Pa .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 do not change the modification time of the target. 104If the target's file flags and mode need not to be changed, 105the target's inode change time is also unchanged. 106.It Fl c 107Copy the file. 108This is actually the default. 109The 110.Fl c 111option is only included for backwards compatibility. 112.It Fl d 113Create directories. 114Missing parent directories are created as required. 115.It Fl f 116Specify the target's file flags; see 117.Xr chflags 1 118for a list of possible flags and their meanings. 119.It Fl g 120Specify a group. 121A numeric GID is allowed. 122.It Fl M 123Disable all use of 124.Xr mmap 2 . 125.It Fl m 126Specify an alternate 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 132Specify an owner. 133A numeric UID is allowed. 134.It Fl p 135Preserve the access and modification times. 136Copy the file, as if the 137.Fl C 138(compare and copy) option is specified, 139except if the target file does not already exist or is different, 140then preserve the access and modification times of the source file. 141.It Fl S 142Safe copy. 143Normally, 144.Nm 145unlinks an existing target before installing the new file. 146With the 147.Fl S 148flag a temporary file is used and then renamed to be 149the target. 150The reason this is safer is that if the copy or 151rename fails, the existing target is left untouched. 152.It Fl s 153.Nm 154exec's the command 155.Xr strip 1 156to strip binaries so that 157.Nm 158can be portable over a large 159number of systems and binary types. 160See below for how 161.Nm 162can be instructed to use another program to strip binaries. 163.It Fl v 164Cause 165.Nm 166to be verbose, 167showing files as they are installed or backed up. 168.El 169.Pp 170By default, 171.Nm 172preserves all file flags, with the exception of the 173.Dq nodump 174flag. 175.Pp 176The 177.Nm 178utility attempts to prevent moving a file onto itself. 179.Pp 180Installing 181.Pa /dev/null 182creates an empty file. 183.Sh ENVIRONMENT 184The 185.Nm 186utility checks for the presence of the 187.Ev STRIPBIN 188environment variable and if present, 189uses the assigned value as the program to run if and when the 190.Fl s 191option has been specified. 192.Pp 193If the 194.Ev DONTSTRIP 195environment variable is present, 196.Nm 197will ignore any specification of the 198.Fl s 199option. 200This is mainly for use in debugging the 201.Fx 202Ports Collection. 203.Sh FILES 204.Bl -tag -width ".Pa INS@XXXX" -compact 205.It Pa INS@XXXX 206If either 207.Fl S 208option is specified, or the 209.Fl C 210or 211.Fl p 212option is used in conjunction with the 213.Fl s 214option, temporary files named 215.Pa INS@XXXX , 216where 217.Pa XXXX 218is decided by 219.Xr mkstemp 3 , 220are created in the target directory. 221.El 222.Sh EXIT STATUS 223.Ex -std 224.Sh COMPATIBILITY 225Historically 226.Nm 227moved files by default. 228The default was changed to copy in 229.Fx 4.4 . 230.Sh SEE ALSO 231.Xr chflags 1 , 232.Xr chgrp 1 , 233.Xr chmod 1 , 234.Xr cp 1 , 235.Xr mv 1 , 236.Xr strip 1 , 237.Xr mmap 2 , 238.Xr chown 8 239.Sh HISTORY 240The 241.Nm 242utility appeared in 243.Bx 4.2 . 244.Sh BUGS 245Temporary files may be left in the target directory if 246.Nm 247exits abnormally. 248.Pp 249File flags cannot be set by 250.Xr fchflags 2 251over a NFS file system. 252Other file systems do not have a concept of flags. 253The 254.Nm 255utility will only warn when flags could not be set on a file system 256that does not support them. 257.Pp 258The 259.Nm 260utility with 261.Fl v 262falsely says a file is copied when 263.Fl C 264snaps hard links. 265