1.\" $NetBSD: install.1,v 1.45 2010/05/14 17:03:19 joerg 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 May 1, 2009 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.It Sy sha256 253The 256-bits 254.Tn SHA-2 255cryptographic message digest of the file. 256.It Sy sha384 257The 384-bits 258.Tn SHA-2 259cryptographic message digest of the file. 260.It Sy sha512 261The 512-bits 262.Tn SHA-2 263cryptographic message digest of the file. 264.El 265.It Fl l Ar linkflags 266Instead of copying the file make a link to the source. 267The type of the link is determined by the 268.Ar linkflags 269argument. 270Valid 271.Ar linkflags 272are: 273.Ar a 274(absolute), 275.Ar r 276(relative), 277.Ar h 278(hard), 279.Ar s 280(symbolic), 281.Ar m 282(mixed). 283Absolute and relative have effect only for symbolic links. 284Mixed links 285are hard links for files on the same filesystem, symbolic otherwise. 286.It Fl M Ar metalog 287Write the metadata associated with each item installed to 288.Ar metalog 289in an 290.Xr mtree 8 291.Dq full path 292specification line. 293The metadata includes: the file name and file type, and depending upon 294other options, the owner, group, file flags, modification time, and tags. 295.It Fl m Ar mode 296Specify an alternative mode. 297The default mode is set to rwxr-xr-x (0755). 298The specified mode may be either an octal or symbolic value; see 299.Xr chmod 1 300for a description of possible mode values. 301.It Fl N Ar dbdir 302Use the user database text file 303.Pa master.passwd 304and group database text file 305.Pa group 306from 307.Ar dbdir , 308rather than using the results from the system's 309.Xr getpwnam 3 310and 311.Xr getgrnam 3 312(and related) library calls. 313.It Fl o Ar owner 314Specify an owner. 315.It Fl p 316Preserve the source files access and modification times. 317.It Fl r 318Install to a temporary file and then rename the file to its final destination 319name. 320This can be used for precious files, to avoid truncation of the original 321when error conditions (filesystem full etc.) occur. 322.It Fl s 323.Nm 324exec's the command 325.Xr strip 1 326to strip binaries so that install can be portable over a large 327number of systems and binary types. 328If the environment variable 329.Ev STRIP 330is set, it is used as the 331.Xr strip 1 332program. 333.It Fl S Ar stripflags 334.Nm 335passes 336.Ar stripflags 337as option arguments to 338.Xr strip 1 . 339When 340.Fl S 341is used, 342.Xr strip 1 343is invoked via the 344.Xr sh 1 345shell, allowing a single 346.Fl S 347argument be to specified to 348.Nm 349which the shell can then tokenize. 350Normally, 351.Nm 352invokes 353.Xr strip 1 354directly. 355This flag implies 356.Fl s . 357.It Fl T Ar tags 358Specify the 359.Xr mtree 8 360tags to write out for the file when using 361.Fl M Ar metalog . 362.It Fl U 363Indicate that install is running unprivileged, and that it should not 364try to change the owner, the group, or the file flags of the destination. 365The information that would have been updated can be stored in a log 366file with 367.Fl M Ar metalog . 368.El 369.Pp 370By default, 371.Nm 372preserves all file flags, with the exception of the ``nodump'' flag. 373.Pp 374The 375.Nm 376utility attempts to prevent copying a file onto itself. 377.Pp 378Installing 379.Pa /dev/null 380creates an empty file. 381.Sh ENVIRONMENT 382.Bl -tag -width Fl 383.It Ev STRIP 384The program used to strip installed binaries when the 385.Fl s 386option is used. 387If unspecified, 388.Pa /usr/bin/strip 389is used. 390.El 391.Sh EXIT STATUS 392.Ex -std 393.Sh SEE ALSO 394.Xr chflags 1 , 395.Xr chgrp 1 , 396.Xr chmod 1 , 397.Xr cp 1 , 398.Xr mv 1 , 399.Xr strip 1 , 400.Xr chown 8 , 401.Xr mtree 8 402.Sh HISTORY 403The 404.Nm 405utility appeared in 406.Bx 4.2 . 407