2 .\" FreeBSD install - a package for the installation and maintainance
3 .\" of non-core utilities.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
18 .\" $FreeBSD: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.35.2.14 2002/12/29 16:35:43 schweikh Exp $
19 .\" $DragonFly: src/usr.sbin/pkg_install/add/Attic/pkg_add.1,v 1.2 2003/06/17 04:29:59 dillon Exp $
26 .Nd a utility for installing software package distributions
32 .Ar pkg-name Op Ar pkg-name ...
36 command is used to extract packages that have been previously created
44 command may execute scripts or programs contained within a package file,
45 your system may be susceptible to
48 attacks from miscreants who create dangerous package files.
50 You are advised to verify the competence and identity of those who
51 provide installable package files. For extra protection, use the
53 flag to extract the package file, and inspect its contents and scripts to
54 ensure it poses no danger to your system's integrity. Pay particular
55 attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL,
56 +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for
64 directives, and/or use the
66 command to examine the package file.
69 The following command line arguments are supported:
70 .Bl -tag -width indent
71 .It Ar pkg-name Op Ar pkg-name ...
72 The named packages are installed. A package name of - will cause
75 If the packages are not found in the current
78 will search them in each directory named by
81 Turn on verbose output.
83 If a installation scripts (pre-install or post-install) exist for a given
84 package, do not execute them.
86 Don't actually install a package, just report the steps that
87 would be taken if it was.
89 Do not record the installation of a package. This means
90 that you cannot deinstall it later, so only use this option if
91 you know what you are doing!
93 Use the remote fetching feature.
94 This will determine the appropriate
95 objformat and release and then fetch and install the package.
97 Force installation to proceed even if prerequisite packages are not
98 installed or the requirements script fails. Although
100 will still try to find and auto-install missing prerequisite packages,
101 a failure to find one will not be fatal.
105 as the directory in which to extract files from a package.
106 If a package has set its default directory, it will be overridden
107 by this flag. Note that only the first
109 directive will be replaced, since
111 has no way of knowing which directory settings are relative and
112 which are absolute. It is rare in any case to see more than one
113 directory transition made, but when such does happen and you wish
114 to have control over *all* directory transitions, then you
115 may then wish to look into the use of
131 By default, this is the string
132 .Pa /var/tmp/instmp.XXXXXX ,
133 but it may be necessary to override it in the situation where
136 directory is limited. Be sure to leave some number of `X' characters
139 to fill in with a unique ID.
141 You can get a performance boost by setting the staging area
143 to reside on the same disk partition as target directories for package
144 file installation; often this is
149 mode. This is a very specialized mode for running
151 and is meant to be run in conjunction with
153 mode. When run in this mode,
155 does no work beyond extracting the package into a temporary staging
158 option), reading in the packing list, and then dumping it (prefaced by
159 the current staging area) to stdout where it may be filtered by a
162 When used in conjunction with
164 mode, it allows you to make radical changes to the package structure
165 before acting on its contents.
169 mode. This is a very specialized mode for running
171 and is meant to be run in conjunction with
173 mode. When run in this mode,
175 expects the release contents to be already extracted and waiting
176 in the staging area, the location of which is read as a string
177 from stdin. The complete packing list is also read from stdin,
178 and the contents then acted on as normal.
183 arguments may be specified, each being either a file containing the
184 package (these usually end with a
187 URL pointing at a file available on an ftp site. Thus you may
188 extract files directly from their anonymous ftp locations (e.g.\&
190 .Li ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/shells/bash-1.14.7.tgz ) .
191 Note: If you wish to use
195 ftp in such transfers, set
200 to some value in your environment. Otherwise, the more standard
201 ACTIVE mode may be used. If
203 consistently fails to fetch a package from a site known to work,
204 it may be because you have a firewall that demands the usage of
209 .Sh TECHNICAL DETAILS
212 utility is fairly simple. It extracts each package's "packing list"
213 into a special staging directory, parses it,
214 and then runs through the following sequence to fully extract the contents:
217 Check if the package is already recorded as installed. If so,
218 terminate installation.
220 Scan all the package dependencies (from
224 and make sure each one is met. If not, try and find the missing
225 dependencies' packages and auto-install them; if they can't be found
226 the installation is terminated.
230 directives which control how the package is added to the system.
231 At the time of this writing, the only currently implemented option is
232 .Cm @option extract-in-place
233 which will cause the package to be extracted directly into its
234 prefix directory without moving through a staging area in
238 .Cm @option extract-in-place
239 is enabled, the package is now extracted directly into its
240 final location, otherwise it is extracted into the staging area.
242 If the package contains a
246 then execute it with the following arguments:
247 .Bd -ragged -offset indent -compact
253 is the name of the package in question and the
255 keyword denotes this as an installation requirements check (useful if
256 you want to have one script serving multiple functions).
260 script exists for the package, it is then executed with the following
262 .Bd -ragged -offset indent -compact
270 is the name of the package in question and
272 is a keyword denoting this as the preinstallation phase.
277 keyword will not appear if separate scripts for pre-install and post-install
278 are given during package creation time (using the
286 .Cm @option extract-in-place
287 is not used, then the packing list (this is the
289 file) is now used as a guide for moving (or copying, as necessary) files from
290 the staging area into their final locations.
292 If the package contains an
296 then mtree is invoked as:
297 .Bd -ragged -offset indent -compact
309 is either the prefix specified with the
313 flag was specified, the name of the first directory named by a
315 directive within this package.
319 script exists for the package, it is then executed as
320 .Bd -ragged -offset indent -compact
327 is the name of the package in question and
329 is a keyword denoting this as the post-installation phase.
334 keyword will not appear if separate scripts for pre-install and post-install
335 are given during package creation time (using the
342 Reasoning behind passing keywords such as
346 is that this allows you to write a single
348 script that does both
352 functionality is more advantageous and easier from a maintenance viewpoint.
354 After installation is complete, a copy of the packing list,
356 script, description, and display files are copied into
357 .Pa /var/db/pkg/<pkg-name>
358 for subsequent possible use by
360 Any package dependencies are recorded in the other packages'
361 .Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY
363 (if the environment variable PKG_DBDIR is set, this overrides the
367 Finally, the staging area is deleted and the program terminates.
370 All the scripts are called with the environment variable
372 set to the installation prefix (see the
374 option above). This allows a package author to write a script
375 that reliably performs some action on the directory where the package
376 is installed, even if the user might change it with the
383 is used if a given package can't be found. The environment variable
384 should be a series of entries separated by colons. Each entry
385 consists of a directory name.
386 The current directory may be indicated
387 implicitly by an empty directory name, or explicitly by a single
390 The environment variable
392 specifies an alternative location for the installed package database.
394 The environment variables
398 in that order, are taken to name temporary directories where
400 will attempt to create its staging area in.
401 If these variables are not present or if the directories named lack
402 sufficient space, then
404 will use the first of
409 with sufficient space.
411 The environment variable
413 specifies an alternate location for
416 The fetch URL is built using this environment variable and the automatic
422 An example setting would be
423 .Qq Li ftp://ftp3.FreeBSD.org .
425 The environment variable
427 specifies an alternate location for
430 This variable subverts the automatic directory logic
436 Thus it should be a complete URL to the remote package file(s).
438 .Bl -tag -width /var/db/pkg -compact
440 Temporary directory for creating the staging area, if environmental variables
444 do not point to a suitable directory.
448 does not exist or has insufficient space.
454 are not suitable for creating the staging area.
456 Default location of the installed package database.
470 .An John Kohl Aq jtk@rational.com
472 Hard links between files in a distribution are only preserved if either
473 (1) the staging area is on the same file system as the target directory of
474 all the links to the file, or (2) all the links to the file are bracketed by
476 directives in the contents file,
478 the link names are extracted with a single
480 command (not split between
481 invocations due to exec argument-space limitations--this depends on the
483 .Fn sysconf _SC_ARG_MAX ) .