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.
16 .\" $FreeBSD: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.66 2005/02/13 22:25:30 ru Exp $
17 .\" $DragonFly: src/usr.sbin/pkg_install/add/pkg_add.1,v 1.5 2005/03/08 20:11:30 joerg Exp $
24 .Nd a utility for installing software package distributions
31 .Ar pkg-name Op Ar pkg-name ...
35 command is used to extract packages that have been previously created
43 command may execute scripts or programs contained within a package file,
44 your system may be susceptible to
47 attacks from miscreants who create dangerous package files.
49 You are advised to verify the competence and identity of those who
50 provide installable package files.
51 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.
56 attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL,
57 +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for
65 directives, and/or use the
67 command to examine the package file.
70 The following command line arguments are supported:
71 .Bl -tag -width indent
72 .It Ar pkg-name Op Ar pkg-name ...
73 The named packages are installed.
79 If the packages are not found in the current
82 will search them in each directory named by
85 Turn on verbose output.
87 If any installation scripts (pre-install or post-install) exist for a given
88 package, do not execute them.
90 Do not actually install a package, just report the steps that
91 would be taken if it was.
93 Do not record the installation of a package.
95 that you cannot deinstall it later, so only use this option if
96 you know what you are doing!
98 Use the remote fetching feature.
99 This will determine the appropriate
100 objformat and release and then fetch and install the package.
102 Force installation to proceed even if prerequisite packages are not
103 installed or the requirements script fails.
106 will still try to find and auto-install missing prerequisite packages,
107 a failure to find one will not be fatal.
111 as the directory in which to extract files from a package.
112 If a package has set its default directory, it will be overridden
114 Note that only the first
116 directive will be replaced, since
118 has no way of knowing which directory settings are relative and
120 It is rare in any case to see more than one
121 directory transition made, but when such does happen and you wish
122 to have control over *all* directory transitions, then you
123 may then wish to look into the use of
139 By default, this is the string
140 .Pa /var/tmp/instmp.XXXXXX ,
141 but it may be necessary to override it in the situation where
144 directory is limited.
145 Be sure to leave some number of `X' characters
148 to fill in with a unique ID.
150 You can get a performance boost by setting the staging area
152 to reside on the same disk partition as target directories for package
153 file installation; often this is
159 This is a very specialized mode for running
161 and is meant to be run in conjunction with
164 When run in this mode,
166 does no work beyond extracting the package into a temporary staging
169 option), reading in the packing list, and then dumping it (prefaced by
170 the current staging area) to stdout where it may be filtered by a
173 When used in conjunction with
175 mode, it allows you to make radical changes to the package structure
176 before acting on its contents.
181 This is a very specialized mode for running
183 and is meant to be run in conjunction with
186 When run in this mode,
188 expects the release contents to be already extracted and waiting
189 in the staging area, the location of which is read as a string
191 The complete packing list is also read from stdin,
192 and the contents then acted on as normal.
193 .It Fl C Ar chrootdir
194 Before doing any operations,
198 directory so that all package files, and the package database, are
203 needs to be a fairly complete file system, including everything normally
207 This flag was added to help support operations done by
209 and is not expected to be useful for much else.
212 is properly configured and cannot be modified by normal users,
213 versions of commands like
222 arguments may be specified, each being either a file containing the
223 package (these usually end with a
226 URL pointing at a file available on an ftp site.
228 extract files directly from their anonymous ftp locations (e.g.\&
230 .Li ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/shells/bash-1.14.7.tbz ) .
231 Note: If you wish to use
235 ftp in such transfers, set
240 to some value in your environment.
241 Otherwise, the more standard
242 ACTIVE mode may be used.
245 consistently fails to fetch a package from a site known to work,
246 it may be because you have a firewall that demands the usage of
251 .Sh TECHNICAL DETAILS
254 utility extracts each package's "packing list" into a special staging
255 directory in /tmp (or $PKG_TMPDIR if set), parses it, and then runs
256 through the following sequence to fully extract the contents of the package:
259 A check is made to determine if the package is already recorded as installed.
260 If it is, installation is terminated.
262 A check is made to determine if the package conflicts (from
266 with an already-installed package.
267 If it is, installation is terminated.
269 Scan all the package dependencies (from
273 are read from the packing list.
274 If any of these required packages is not currently installed,
275 an attempt is made to find and install it;
276 if the missing package cannot be found or installed,
277 the installation is terminated.
281 directives which control how the package is added to the system.
282 At the time of this writing, the only currently implemented option is
283 .Cm @option extract-in-place
284 which will cause the package to be extracted directly into its
285 prefix directory without moving through a staging area in
289 .Cm @option extract-in-place
290 is enabled, the package is now extracted directly into its
291 final location, otherwise it is extracted into the staging area.
293 If the package contains a
297 then execute it with the following arguments:
298 .Bd -ragged -offset indent -compact
304 is the name of the package in question and the
306 keyword denotes this as an installation requirements check (useful if
307 you want to have one script serving multiple functions).
311 script exists for the package, it is then executed with the following
313 .Bd -ragged -offset indent -compact
321 is the name of the package in question and
323 is a keyword denoting this as the preinstallation phase.
328 keyword will not appear if separate scripts for pre-install and post-install
329 are given during package creation time (using the
337 .Cm @option extract-in-place
338 is not used, then the packing list (this is the
340 file) is now used as a guide for moving (or copying, as necessary) files from
341 the staging area into their final locations.
343 If the package contains an
347 then mtree is invoked as:
348 .Bd -ragged -offset indent -compact
360 is either the prefix specified with the
364 flag was specified, the name of the first directory named by a
366 directive within this package.
370 script exists for the package, it is then executed as
371 .Bd -ragged -offset indent -compact
378 is the name of the package in question and
380 is a keyword denoting this as the post-installation phase.
385 keyword will not appear if separate scripts for pre-install and post-install
386 are given during package creation time (using the
393 Reasoning behind passing keywords such as
397 is that this allows you to write a single
399 script that does both
403 functionality is more advantageous and easier from a maintenance viewpoint.
405 After installation is complete, a copy of the packing list,
407 script, description, and display files are copied into
408 .Pa /var/db/pkg/<pkg-name>
409 for subsequent possible use by
411 Any package dependencies are recorded in the other packages'
412 .Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY
414 (if the environment variable PKG_DBDIR is set, this overrides the
418 Finally, the staging area is deleted and the program terminates.
421 All the scripts are called with the environment variable
423 set to the installation prefix (see the
426 This allows a package author to write a script
427 that reliably performs some action on the directory where the package
428 is installed, even if the user might change it with the
435 is used if a given package cannot be found.
436 The environment variable
437 should be a series of entries separated by colons.
439 consists of a directory name.
440 The current directory may be indicated
441 implicitly by an empty directory name, or explicitly by a single
444 The environment variable
446 specifies an alternative location for the installed package database,
450 The environment variables
454 in that order, are taken to name temporary directories where
456 will attempt to create its staging area in.
457 If these variables are not present or if the directories named lack
458 sufficient space, then
460 will use the first of
465 with sufficient space.
467 The environment variable
469 specifies an alternate location for
472 The fetch URL is built using this environment variable and the automatic
478 An example setting would be
479 .Qq Li ftp://ftp3.FreeBSD.org .
481 The environment variable
483 specifies an alternate location for
486 This variable subverts the automatic directory logic
492 Thus it should be a complete URL to the remote package file(s).
494 .Bl -tag -width /var/db/pkg -compact
496 Temporary directory for creating the staging area, if environmental variables
500 do not point to a suitable directory.
504 does not exist or has insufficient space.
510 are not suitable for creating the staging area.
512 Default location of the installed package database.
525 .An John Kohl Aq jtk@rational.com
527 Hard links between files in a distribution are only preserved if either
528 (1) the staging area is on the same file system as the target directory of
529 all the links to the file, or (2) all the links to the file are bracketed by
531 directives in the contents file,
533 the link names are extracted with a single
535 command (not split between
536 invocations due to exec argument-space limitations--this depends on the
538 .Fn sysconf _SC_ARG_MAX ) .