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