xref: /freebsd/usr.bin/xinstall/install.1 (revision a0439a1b820fa0e742c00d095f5f5c06f5f19432)
19b50d902SRodney W. Grimes.\" Copyright (c) 1987, 1990, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
69b50d902SRodney W. Grimes.\" are met:
79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
89b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
119b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12209e744fSEd Maste.\" 3. Neither the name of the University nor the names of its contributors
139b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
149b50d902SRodney W. Grimes.\"    without specific prior written permission.
159b50d902SRodney W. Grimes.\"
169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269b50d902SRodney W. Grimes.\" SUCH DAMAGE.
279b50d902SRodney W. Grimes.\"
28*a0439a1bSDag-Erling Smørgrav.Dd April 16, 2024
299b50d902SRodney W. Grimes.Dt INSTALL 1
30f120c88cSRuslan Ermilov.Os
319b50d902SRodney W. Grimes.Sh NAME
329b50d902SRodney W. Grimes.Nm install
339b50d902SRodney W. Grimes.Nd install binaries
349b50d902SRodney W. Grimes.Sh SYNOPSIS
358fe908efSRuslan Ermilov.Nm
36bf8596f6SBrooks Davis.Op Fl bCcpSsUv
37f120c88cSRuslan Ermilov.Op Fl B Ar suffix
38f2b19f9eSBrooks Davis.Op Fl D Ar destdir
399b50d902SRodney W. Grimes.Op Fl f Ar flags
409b50d902SRodney W. Grimes.Op Fl g Ar group
41f2b19f9eSBrooks Davis.Op Fl h Ar hash
42f2b19f9eSBrooks Davis.Op Fl l Ar linkflags
43f2b19f9eSBrooks Davis.Op Fl M Ar metalog
449b50d902SRodney W. Grimes.Op Fl m Ar mode
45a6a1856eSBrooks Davis.Op Fl N Ar dbdir
469b50d902SRodney W. Grimes.Op Fl o Ar owner
47f2b19f9eSBrooks Davis.Op Fl T Ar tags
489b50d902SRodney W. Grimes.Ar file1 file2
498fe908efSRuslan Ermilov.Nm
50bf8596f6SBrooks Davis.Op Fl bCcpSsUv
51f120c88cSRuslan Ermilov.Op Fl B Ar suffix
52f2b19f9eSBrooks Davis.Op Fl D Ar destdir
539b50d902SRodney W. Grimes.Op Fl f Ar flags
549b50d902SRodney W. Grimes.Op Fl g Ar group
55f2b19f9eSBrooks Davis.Op Fl h Ar hash
56f2b19f9eSBrooks Davis.Op Fl l Ar linkflags
57f2b19f9eSBrooks Davis.Op Fl M Ar metalog
589b50d902SRodney W. Grimes.Op Fl m Ar mode
59a6a1856eSBrooks Davis.Op Fl N Ar dbdir
609b50d902SRodney W. Grimes.Op Fl o Ar owner
61f2b19f9eSBrooks Davis.Op Fl T Ar tags
62b4ad2d5fSRuslan Ermilov.Ar file1 ... fileN directory
638fe908efSRuslan Ermilov.Nm
64a9c6b614SWarner Losh.Fl d
65f2b19f9eSBrooks Davis.Op Fl Uv
66f2b19f9eSBrooks Davis.Op Fl D Ar destdir
67a9c6b614SWarner Losh.Op Fl g Ar group
68f2b19f9eSBrooks Davis.Op Fl h Ar hash
69f2b19f9eSBrooks Davis.Op Fl M Ar metalog
70a9c6b614SWarner Losh.Op Fl m Ar mode
71a6a1856eSBrooks Davis.Op Fl N Ar dbdir
72a9c6b614SWarner Losh.Op Fl o Ar owner
73f2b19f9eSBrooks Davis.Op Fl T Ar tags
74b4ad2d5fSRuslan Ermilov.Ar directory ...
759b50d902SRodney W. Grimes.Sh DESCRIPTION
76b4ad2d5fSRuslan ErmilovThe file(s) are copied
77f2b19f9eSBrooks Davis(or linked if the
78f2b19f9eSBrooks Davis.Fl l
79f2b19f9eSBrooks Davisoption is specified) to the target file or directory.
809b50d902SRodney W. GrimesIf the destination is a directory, then the
819b50d902SRodney W. Grimes.Ar file
82b4ad2d5fSRuslan Ermilovis copied into
839b50d902SRodney W. Grimes.Ar directory
849b50d902SRodney W. Grimeswith its original filename.
85f120c88cSRuslan ErmilovIf the target file already exists, it is
86f120c88cSRuslan Ermiloveither renamed to
87f120c88cSRuslan Ermilov.Ar file Ns Pa .old
88f120c88cSRuslan Ermilovif the
89f120c88cSRuslan Ermilov.Fl b
90f120c88cSRuslan Ermilovoption is given
91f120c88cSRuslan Ermilovor overwritten
92f120c88cSRuslan Ermilovif permissions allow.
93f120c88cSRuslan ErmilovAn alternate backup suffix may be specified via the
94f120c88cSRuslan Ermilov.Fl B
95f120c88cSRuslan Ermilovoption's argument.
969b50d902SRodney W. Grimes.Pp
97f120c88cSRuslan ErmilovThe options are as follows:
98f120c88cSRuslan Ermilov.Bl -tag -width indent
99f44e2577SDag-Erling Smørgrav.It Fl B Ar suffix
100f44e2577SDag-Erling SmørgravUse
101f44e2577SDag-Erling Smørgrav.Ar suffix
102f44e2577SDag-Erling Smørgravas the backup suffix if
103f44e2577SDag-Erling Smørgrav.Fl b
104f44e2577SDag-Erling Smørgravis given.
105f120c88cSRuslan Ermilov.It Fl b
106f120c88cSRuslan ErmilovBack up any existing files before overwriting them by renaming
107f120c88cSRuslan Ermilovthem to
108f120c88cSRuslan Ermilov.Ar file Ns Pa .old .
109f120c88cSRuslan ErmilovSee
110f120c88cSRuslan Ermilov.Fl B
111f120c88cSRuslan Ermilovfor specifying a different backup suffix.
112ade9638bSMike Pritchard.It Fl C
113f120c88cSRuslan ErmilovCopy the file.
114f120c88cSRuslan ErmilovIf the target file already exists and the files are the same,
1150227791bSRuslan Ermilovthen do not change the modification time of the target.
116b9889f93SRuslan ErmilovIf the target's file flags and mode need not to be changed,
117b9889f93SRuslan Ermilovthe target's inode change time is also unchanged.
1189b50d902SRodney W. Grimes.It Fl c
1199b50d902SRodney W. GrimesCopy the file.
120f120c88cSRuslan ErmilovThis is actually the default.
121f120c88cSRuslan ErmilovThe
122f120c88cSRuslan Ermilov.Fl c
123f120c88cSRuslan Ermilovoption is only included for backwards compatibility.
124f2b19f9eSBrooks Davis.It Fl D Ar destdir
125f2b19f9eSBrooks DavisSpecify the
126f2b19f9eSBrooks Davis.Ev DESTDIR
127f2b19f9eSBrooks Davis(top of the file hierarchy) that the items are installed in to.
128f2b19f9eSBrooks DavisIf
129f2b19f9eSBrooks Davis.Fl M Ar metalog
130f2b19f9eSBrooks Davisis in use, a leading string of
131f2b19f9eSBrooks Davis.Dq Ar destdir
132f2b19f9eSBrooks Daviswill be removed from the file names logged to the
133f2b19f9eSBrooks Davis.Ar metalog .
134f2b19f9eSBrooks DavisThis option does not affect where the actual files are installed.
135a9c6b614SWarner Losh.It Fl d
136a9c6b614SWarner LoshCreate directories.
137a9c6b614SWarner LoshMissing parent directories are created as required.
1389236a881SMateusz Piotrowski.It Fl f Ar flags
1397d85a3e8SPhilippe CharnierSpecify the target's file flags; see
1409b50d902SRodney W. Grimes.Xr chflags 1
1417d85a3e8SPhilippe Charnierfor a list of possible flags and their meanings.
1429236a881SMateusz Piotrowski.It Fl g Ar group
14387faa07bSSheldon HearnSpecify a group.
14487faa07bSSheldon HearnA numeric GID is allowed.
145f2b19f9eSBrooks Davis.It Fl h Ar hash
146f2b19f9eSBrooks DavisWhen copying, calculate the digest of the files with
147f2b19f9eSBrooks Davis.Ar hash
148f2b19f9eSBrooks Davisto store in the
149f2b19f9eSBrooks Davis.Fl M Ar metalog .
150f2b19f9eSBrooks DavisWhen
151f2b19f9eSBrooks Davis.Fl d
152f2b19f9eSBrooks Davisis given no hash is emitted.
153f2b19f9eSBrooks DavisSupported digests:
154f2b19f9eSBrooks Davis.Bl -tag -width rmd160 -offset indent
155f2b19f9eSBrooks Davis.It Sy none
156f2b19f9eSBrooks DavisNo hash.
157f2b19f9eSBrooks DavisThis is the default.
158f2b19f9eSBrooks Davis.It Sy md5
159f2b19f9eSBrooks DavisThe MD5 cryptographic message digest.
160f2b19f9eSBrooks Davis.It Sy rmd160
161f2b19f9eSBrooks DavisThe RMD-160 cryptographic message digest.
162f2b19f9eSBrooks Davis.It Sy sha1
163f2b19f9eSBrooks DavisThe SHA-1 cryptographic message digest.
164f2b19f9eSBrooks Davis.It Sy sha256
1659236a881SMateusz PiotrowskiThe 256-bits SHA-2 cryptographic message digest of the file.
166f2b19f9eSBrooks Davis.It Sy sha512
1679236a881SMateusz PiotrowskiThe 512-bits SHA-2 cryptographic message digest of the file.
168f2b19f9eSBrooks Davis.El
169f2b19f9eSBrooks Davis.It Fl l Ar linkflags
170f2b19f9eSBrooks DavisInstead of copying the file make a link to the source.
171f2b19f9eSBrooks DavisThe type of the link is determined by the
172f2b19f9eSBrooks Davis.Ar linkflags
173f2b19f9eSBrooks Davisargument.
174f2b19f9eSBrooks DavisValid
175f2b19f9eSBrooks Davis.Ar linkflags
176f2b19f9eSBrooks Davisare:
177f2b19f9eSBrooks Davis.Ar a
178f2b19f9eSBrooks Davis(absolute),
179f2b19f9eSBrooks Davis.Ar r
180f2b19f9eSBrooks Davis(relative),
181f2b19f9eSBrooks Davis.Ar h
182f2b19f9eSBrooks Davis(hard),
183f2b19f9eSBrooks Davis.Ar s
184f2b19f9eSBrooks Davis(symbolic),
185f2b19f9eSBrooks Davis.Ar m
186f2b19f9eSBrooks Davis(mixed).
187f2b19f9eSBrooks DavisAbsolute and relative have effect only for symbolic links.
188f2b19f9eSBrooks DavisMixed links
189f2b19f9eSBrooks Davisare hard links for files on the same filesystem, symbolic otherwise.
190f2b19f9eSBrooks Davis.It Fl M Ar metalog
191f2b19f9eSBrooks DavisWrite the metadata associated with each item installed to
192f2b19f9eSBrooks Davis.Ar metalog
193f2b19f9eSBrooks Davisin an
194f2b19f9eSBrooks Davis.Xr mtree 8
195f2b19f9eSBrooks Davis.Dq full path
196f2b19f9eSBrooks Davisspecification line.
197f2b19f9eSBrooks DavisThe metadata includes: the file name and file type, and depending upon
198f2b19f9eSBrooks Davisother options, the owner, group, file flags, modification time, and tags.
1999236a881SMateusz Piotrowski.It Fl m Ar mode
2009b50d902SRodney W. GrimesSpecify an alternate mode.
2019b50d902SRodney W. GrimesThe default mode is set to rwxr-xr-x (0755).
2029b50d902SRodney W. GrimesThe specified mode may be either an octal or symbolic value; see
2039b50d902SRodney W. Grimes.Xr chmod 1
2049b50d902SRodney W. Grimesfor a description of possible mode values.
2059236a881SMateusz Piotrowski.It Fl N Ar dbdir
206a6a1856eSBrooks DavisUse the user database text file
207a6a1856eSBrooks Davis.Pa master.passwd
208a6a1856eSBrooks Davisand group database text file
209a6a1856eSBrooks Davis.Pa group
210a6a1856eSBrooks Davisfrom
211a6a1856eSBrooks Davis.Ar dbdir ,
212a6a1856eSBrooks Davisrather than using the results from the system's
213a6a1856eSBrooks Davis.Xr getpwnam 3
214a6a1856eSBrooks Davisand
215a6a1856eSBrooks Davis.Xr getgrnam 3
216a6a1856eSBrooks Davis(and related) library calls.
2179236a881SMateusz Piotrowski.It Fl o Ar owner
21887faa07bSSheldon HearnSpecify an owner.
21987faa07bSSheldon HearnA numeric UID is allowed.
220de264c2bSBruce Evans.It Fl p
221b9889f93SRuslan ErmilovPreserve the access and modification times.
222de264c2bSBruce EvansCopy the file, as if the
223de264c2bSBruce Evans.Fl C
224f120c88cSRuslan Ermilov(compare and copy) option is specified,
2250227791bSRuslan Ermilovexcept if the target file does not already exist or is different,
226b9889f93SRuslan Ermilovthen preserve the access and modification times of the source file.
227f120c88cSRuslan Ermilov.It Fl S
228e5035d08SDag-Erling SmørgravFlush each file to disk after copying.
229e5035d08SDag-Erling SmørgravThis has a non-negligible impact on performance, but reduces the risk
230e5035d08SDag-Erling Smørgravof being left with a partial file if the system crashes or loses power
231e5035d08SDag-Erling Smørgravshortly after
232f120c88cSRuslan Ermilov.Nm
233e5035d08SDag-Erling Smørgravruns.
234e5035d08SDag-Erling Smørgrav.Pp
235e5035d08SDag-Erling SmørgravHistorically,
236f120c88cSRuslan Ermilov.Fl S
237e5035d08SDag-Erling Smørgravalso enabled the use of temporary files to ensure atomicity when
238e5035d08SDag-Erling Smørgravreplacing an existing target.
239e5035d08SDag-Erling SmørgravTemporary files are no longer optional.
2409b50d902SRodney W. Grimes.It Fl s
241f120c88cSRuslan Ermilov.Nm
2429b50d902SRodney W. Grimesexec's the command
2439b50d902SRodney W. Grimes.Xr strip 1
244f120c88cSRuslan Ermilovto strip binaries so that
245f120c88cSRuslan Ermilov.Nm
246f120c88cSRuslan Ermilovcan be portable over a large
2479b50d902SRodney W. Grimesnumber of systems and binary types.
24874b010ebSMarcel MoolenaarSee below for how
24974b010ebSMarcel Moolenaar.Nm
25074b010ebSMarcel Moolenaarcan be instructed to use another program to strip binaries.
251f2b19f9eSBrooks Davis.It Fl T Ar tags
252f2b19f9eSBrooks DavisSpecify the
253f2b19f9eSBrooks Davis.Xr mtree 8
254f2b19f9eSBrooks Davistags to write out for the file when using
255f2b19f9eSBrooks Davis.Fl M Ar metalog .
256f2b19f9eSBrooks Davis.It Fl U
257f2b19f9eSBrooks DavisIndicate that install is running unprivileged, and that it should not
258f2b19f9eSBrooks Davistry to change the owner, the group, or the file flags of the destination.
259f2b19f9eSBrooks DavisThe information that would have been updated can be stored in a log
260f2b19f9eSBrooks Davisfile with
261f2b19f9eSBrooks Davis.Fl M Ar metalog .
262522f2bf8SDavid E. O'Brien.It Fl v
26365c7e9c1SRuslan ErmilovCause
264522f2bf8SDavid E. O'Brien.Nm
26565c7e9c1SRuslan Ermilovto be verbose,
26665c7e9c1SRuslan Ermilovshowing files as they are installed or backed up.
2679b50d902SRodney W. Grimes.El
2689b50d902SRodney W. Grimes.Pp
2699b50d902SRodney W. GrimesBy default,
2707d85a3e8SPhilippe Charnier.Nm
271f120c88cSRuslan Ermilovpreserves all file flags, with the exception of the
272f120c88cSRuslan Ermilov.Dq nodump
273f120c88cSRuslan Ermilovflag.
2749b50d902SRodney W. Grimes.Pp
2759b50d902SRodney W. GrimesThe
2767d85a3e8SPhilippe Charnier.Nm
2779b50d902SRodney W. Grimesutility attempts to prevent moving a file onto itself.
2789b50d902SRodney W. Grimes.Pp
2799b50d902SRodney W. GrimesInstalling
2809b50d902SRodney W. Grimes.Pa /dev/null
2819b50d902SRodney W. Grimescreates an empty file.
28274b010ebSMarcel Moolenaar.Sh ENVIRONMENT
28374b010ebSMarcel MoolenaarThe
28474b010ebSMarcel Moolenaar.Nm
28574b010ebSMarcel Moolenaarutility checks for the presence of the
28674b010ebSMarcel Moolenaar.Ev STRIPBIN
28774b010ebSMarcel Moolenaarenvironment variable and if present,
28874b010ebSMarcel Moolenaaruses the assigned value as the program to run if and when the
28974b010ebSMarcel Moolenaar.Fl s
29074b010ebSMarcel Moolenaaroption has been specified.
291858494e4SDavid E. O'Brien.Pp
292858494e4SDavid E. O'BrienIf the
293858494e4SDavid E. O'Brien.Ev DONTSTRIP
294cb29445aSRuslan Ermilovenvironment variable is present,
295858494e4SDavid E. O'Brien.Nm
296858494e4SDavid E. O'Brienwill ignore any specification of the
297858494e4SDavid E. O'Brien.Fl s
298858494e4SDavid E. O'Brienoption.
299cb29445aSRuslan ErmilovThis is mainly for use in debugging the
300cb29445aSRuslan Ermilov.Fx
301cb29445aSRuslan ErmilovPorts Collection.
302de264c2bSBruce Evans.Sh FILES
3030fd54da0SAlex Richardson.Bl -tag -width "INS@XXXXXX" -compact
3040fd54da0SAlex Richardson.It Pa INS@XXXXXX
305e5035d08SDag-Erling SmørgravTemporary files named
3060fd54da0SAlex Richardson.Pa INS@XXXXXX ,
307f120c88cSRuslan Ermilovwhere
3080fd54da0SAlex Richardson.Pa XXXXXX
309f120c88cSRuslan Ermilovis decided by
310de264c2bSBruce Evans.Xr mkstemp 3 ,
311de264c2bSBruce Evansare created in the target directory.
3129b88faecSRuslan Ermilov.El
3136c7216dfSRuslan Ermilov.Sh EXIT STATUS
3146c7216dfSRuslan Ermilov.Ex -std
315b4ad2d5fSRuslan Ermilov.Sh COMPATIBILITY
316b4ad2d5fSRuslan ErmilovHistorically
317b4ad2d5fSRuslan Ermilov.Nm
318b4ad2d5fSRuslan Ermilovmoved files by default.
319b4ad2d5fSRuslan ErmilovThe default was changed to copy in
320b4ad2d5fSRuslan Ermilov.Fx 4.4 .
3219b50d902SRodney W. Grimes.Sh SEE ALSO
3229b50d902SRodney W. Grimes.Xr chflags 1 ,
3239b50d902SRodney W. Grimes.Xr chgrp 1 ,
3249b50d902SRodney W. Grimes.Xr chmod 1 ,
3259b50d902SRodney W. Grimes.Xr cp 1 ,
3269b50d902SRodney W. Grimes.Xr mv 1 ,
3279b50d902SRodney W. Grimes.Xr strip 1 ,
328a6a1856eSBrooks Davis.Xr getgrnam 3 ,
329a6a1856eSBrooks Davis.Xr getpwnam 3 ,
3309b50d902SRodney W. Grimes.Xr chown 8
3319b50d902SRodney W. Grimes.Sh HISTORY
3329b50d902SRodney W. GrimesThe
3337d85a3e8SPhilippe Charnier.Nm
3349b50d902SRodney W. Grimesutility appeared in
3359b50d902SRodney W. Grimes.Bx 4.2 .
336de264c2bSBruce Evans.Sh BUGS
337f2b19f9eSBrooks DavisThe meaning of the
338f2b19f9eSBrooks Davis.Fl M
339f2b19f9eSBrooks Davisoption has changed as of
34078229472SBrooks Davis.Fx 9.2
341f2b19f9eSBrooks Davisand it now takes an argument.
342f2b19f9eSBrooks DavisCommand lines that used the old
343f2b19f9eSBrooks Davis.Fl M
344f2b19f9eSBrooks Daviswill get an error or in rare cases will append logs to the first of
345f2b19f9eSBrooks Davismultiple source files rather than installing it.
346f2b19f9eSBrooks Davis.Pp
347de264c2bSBruce EvansTemporary files may be left in the target directory if
3487d85a3e8SPhilippe Charnier.Nm
349de264c2bSBruce Evansexits abnormally.
350defff809SPeter Wemm.Pp
351defff809SPeter WemmFile flags cannot be set by
35230035fd5SPeter Wemm.Xr fchflags 2
3536a3e8b0aSRuslan Ermilovover a NFS file system.
3546a3e8b0aSRuslan ErmilovOther file systems do not have a concept of flags.
355e8937ba0SPhilippe CharnierThe
356defff809SPeter Wemm.Nm
357e8937ba0SPhilippe Charnierutility will only warn when flags could not be set on a file system
358defff809SPeter Wemmthat does not support them.
359522f2bf8SDavid E. O'Brien.Pp
360e8937ba0SPhilippe CharnierThe
361522f2bf8SDavid E. O'Brien.Nm
362e8937ba0SPhilippe Charnierutility with
363522f2bf8SDavid E. O'Brien.Fl v
364522f2bf8SDavid E. O'Brienfalsely says a file is copied when
365522f2bf8SDavid E. O'Brien.Fl C
366522f2bf8SDavid E. O'Briensnaps hard links.
367