1.\" $NetBSD: install.1,v 1.37 2003/05/24 18:24:28 jmmv Exp $ 2.\" 3.\" Copyright (c) 1987, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)install.1 8.1 (Berkeley) 6/6/93 35.\" 36.Dd December 21, 2002 37.Dt INSTALL 1 38.Os 39.Sh NAME 40.Nm install 41.Nd install binaries 42.Sh SYNOPSIS 43.Nm 44.Op Fl Ubcprs 45.Bk -words 46.Op Fl B Ar suffix 47.Ek 48.Bk -words 49.Op Fl D Ar destdir 50.Ek 51.Bk -words 52.Op Fl f Ar flags 53.Ek 54.Bk -words 55.Op Fl M Ar metalog 56.Ek 57.Bk -words 58.Op Fl T Ar tags 59.Ek 60.Bk -words 61.Op Fl a Ar command 62.Ek 63.Bk -words 64.Op Fl m Ar mode 65.Ek 66.Bk -words 67.Op Fl N Ar dbdir 68.Ek 69.Bk -words 70.Op Fl o Ar owner 71.Ek 72.Bk -words 73.Op Fl g Ar group 74.Ek 75.Bk -words 76.Op Fl l Ar linkflags 77.Ek 78.Bk -words 79.Op Fl S Ar stripflag 80.Ek 81.Ar file1 file2 82.Nm 83.Op Fl Ubcprs 84.Bk -words 85.Op Fl B Ar suffix 86.Ek 87.Bk -words 88.Op Fl D Ar destdir 89.Ek 90.Bk -words 91.Op Fl f Ar flags 92.Ek 93.Bk -words 94.Op Fl M Ar metalog 95.Ek 96.Bk -words 97.Op Fl T Ar tags 98.Ek 99.Bk -words 100.Op Fl a Ar command 101.Ek 102.Bk -words 103.Op Fl m Ar mode 104.Ek 105.Bk -words 106.Op Fl N Ar dbdir 107.Ek 108.Bk -words 109.Op Fl o Ar owner 110.Ek 111.Bk -words 112.Op Fl g Ar group 113.Ek 114.Bk -words 115.Op Fl l Ar linkflags 116.Ek 117.Bk -words 118.Op Fl S Ar stripflag 119.Ek 120.Ar file1 ...\& 121.Ar fileN directory 122.Nm 123.Fl d 124.Op Fl Up 125.Bk -words 126.Op Fl D Ar destdir 127.Ek 128.Bk -words 129.Op Fl M Ar metalog 130.Ek 131.Bk -words 132.Op Fl T Ar tags 133.Ek 134.Bk -words 135.Op Fl a Ar command 136.Ek 137.Bk -words 138.Op Fl m Ar mode 139.Ek 140.Bk -words 141.Op Fl N Ar dbdir 142.Ek 143.Bk -words 144.Op Fl o Ar owner 145.Ek 146.Bk -words 147.Op Fl g Ar group 148.Ek 149.Ar directory ...\& 150.Sh DESCRIPTION 151The file(s) are moved (copied if the 152.Fl c 153option is specified, or linked if the 154.Fl l 155option is specified) to the target file or directory. 156If the destination is a directory, then the 157.Ar file 158is moved into 159.Ar directory 160with its original filename. 161If the target file already exists, it is 162either renamed to 163.Ar file.old 164if the 165.Fl b 166option is given 167or overwritten 168if permissions allow; an alternate backup suffix may be specified via the 169.Fl B 170option's argument. 171.Pp 172.Bl -tag -width Ds 173.It Fl a Ar command 174Run 175.Ar command 176on the target after installation and stripping 177.Pq Fl s , 178but before 179ownership, permissions or timestamps are set and before renaming 180.Pq Fl r 181occurs. 182.Ar command 183is invoked via the 184.Xr sh 1 185shell, allowing a single 186.Fl a 187argument be to specified to 188.Nm 189which the shell can then tokenize. 190.It Fl b 191Backup any existing files before overwriting them by renaming 192them to 193.Ar file.old . See 194.Fl B 195for specifying a different backup suffix. 196.It Fl B Ar suffix 197Use 198.Ar suffix 199as the backup suffix if 200.Fl b 201is given. 202If 203.Ar suffix 204contains a '%' sign, a numbered backup will be performed, and the 205%-pattern will be expanded using 206.Xr sprintf 3 , 207given an integer counter as the backup number. 208The counter used starts from 0, and the first available name resulting 209from the expansion is used. 210.It Fl c 211Copy the file. 212This flag turns off the default behavior of 213.Nm 214where it deletes the original file after creating the target. 215.It Fl d 216Create directories. 217Missing parent directories are created as required. 218.It Fl D Ar destdir 219Specify the 220.Ev DESTDIR 221(top of the file hierarchy) that the items are installed in to. 222If 223.Fl M Ar metalog 224is in use, a leading string of 225.Dq Ar destdir 226will be removed from the file names logged to the 227.Ar metalog . 228This option does not affect where the actual files are installed. 229.It Fl f Ar flags 230Specify the target's file flags. 231(See 232.Xr chflags 1 233for a list of possible flags and their meanings.) 234.It Fl g Ar group 235Specify a group. 236.It Fl l Ar linkflags 237Instead of copying the file make a link to the source. 238The type of the link is determined by the 239.Ar linkflags 240argument. 241Valid 242.Ar linkflags 243are: 244.Ar a 245(absolute), 246.Ar r 247(relative), 248.Ar h 249(hard), 250.Ar s 251(symbolic), 252.Ar m 253(mixed). 254Absolute and relative have effect only for symbolic links. 255Mixed links 256are hard links for files on the same filesystem, symbolic otherwise. 257.It Fl M Ar metalog 258Write the metadata associated with each item installed to 259.Ar metalog 260in an 261.Xr mtree 8 262.Dq full path 263specification line. 264The metadata includes: the file name and file type, and depending upon 265other options, the owner, group, file flags, modification time, and tags. 266.It Fl m Ar mode 267Specify an alternative mode. 268The default mode is set to rwxr-xr-x (0755). 269The specified mode may be either an octal or symbolic value; see 270.Xr chmod 1 271for a description of possible mode values. 272.It Fl N Ar dbdir 273Use the user database text file 274.Pa master.passwd 275and group database text file 276.Pa group 277from 278.Ar dbdir , 279rather than using the results from the system's 280.Xr getpwnam 3 281and 282.Xr getgrnam 3 283(and related) library calls. 284.It Fl o Ar owner 285Specify an owner. 286.It Fl p 287Preserve the source files access and modification times. 288.It Fl r 289Install to a temporary file and then rename the file to its final destination 290name. 291This can be used for precious files, to avoid truncation of the original 292when error conditions (filesystem full etc.) occur. 293.It Fl s 294.Nm 295exec's the command 296.Xr strip 1 297to strip binaries so that install can be portable over a large 298number of systems and binary types. 299If the environment variable 300.Ev STRIP 301is set, it is used as the 302.Xr strip 1 303program. 304.It Fl S Ar stripflags 305.Nm 306passes 307.Ar stripflags 308as option arguments to 309.Xr strip 1 . 310When 311.Fl S 312is used, 313.Xr strip 1 314is invoked via the 315.Xr sh 1 316shell, allowing a single 317.Fl S 318argument be to specified to 319.Nm 320which the shell can then tokenize. 321Normally, 322.Nm 323invokes 324.Xr strip 1 325directly. 326This flag implies 327.Fl s . 328.It Fl T Ar tags 329Specify the 330.Xr mtree 8 331tags to write out for the file when using 332.Fl M Ar metalog . 333.It Fl U 334Indicate that install is running unprivileged, and that it should not 335try to change the owner, the group, or the file flags of the destination. 336The information that would have been updated can be stored in a log 337file with 338.Fl M Ar metalog . 339.El 340.Pp 341By default, 342.Nm 343preserves all file flags, with the exception of the ``nodump'' flag. 344.Pp 345The 346.Nm 347utility attempts to prevent moving a file onto itself. 348.Pp 349Installing 350.Pa /dev/null 351creates an empty file. 352.Sh EXIT STATUS 353The 354.Nm 355utility exits 0 on success, 356and \*[Gt]0 if an error occurs. 357.Sh ENVIRONMENT 358.Bl -tag -width Fl 359.It Ev STRIP 360The program used to strip installed binaries when the 361.Fl s 362option is used. 363If unspecified, 364.Pa /usr/bin/strip 365is used. 366.El 367.Sh SEE ALSO 368.Xr chflags 1 , 369.Xr chgrp 1 , 370.Xr chmod 1 , 371.Xr cp 1 , 372.Xr mv 1 , 373.Xr strip 1 , 374.Xr chown 8 , 375.Xr mtree 8 376.Sh HISTORY 377The 378.Nm 379utility appeared in 380.Bx 4.2 . 381