1.\" $OpenBSD: install.1,v 1.30 2016/05/13 17:51:15 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: May 13 2016 $ 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 , S , 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. 144Normally, 145.Nm 146unlinks an existing target before installing the new file. 147With the 148.Fl S 149flag a temporary file is used and then renamed to be 150the target. 151The reason this is safer is that if the copy or 152rename fails, the existing target is left untouched. 153.It Fl s 154.Nm 155exec's the command 156.Pa /usr/bin/strip 157to strip binaries so that install can be portable over a large 158number of systems and binary types. 159If the environment variable 160.Ev STRIP 161is set, it is used instead. 162.El 163.Pp 164By default, 165.Nm 166preserves all file flags, with the exception of the 167.Dq nodump 168flag. 169.Pp 170The 171.Nm 172utility attempts to prevent moving a file onto itself. 173.Pp 174Installing 175.Pa /dev/null 176creates an empty file. 177.Sh ENVIRONMENT 178.Bl -tag -width "STRIP" 179.It Ev STRIP 180For an alternate 181.Xr strip 1 182program to run. 183Default is 184.Pa /usr/bin/strip . 185.El 186.Sh FILES 187.Bl -tag -width INS@XXXXXXXXXX -compact 188.It Pa INS@XXXXXXXXXX 189If either 190.Fl S 191option is specified, or the 192.Fl C 193or 194.Fl p 195option is used in conjunction with the 196.Fl s 197option, temporary files named INS@XXXXXXXXXX, 198where XXXXXXXXXX is decided by 199.Xr mkstemp 3 , 200are created in the target directory. 201.El 202.Sh EXIT STATUS 203.Ex -std install 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 213The 214.Nm 215utility appeared in 216.Bx 4.2 . 217.Sh CAVEATS 218The 219.Fl C , 220.Fl D , 221.Fl F , 222.Fl p , 223and 224.Fl S 225flags are non-standard and should not be relied upon for portability. 226.Pp 227Temporary files may be left in the target directory if 228.Nm 229exits abnormally. 230