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 $
25 .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. For extra protection, use the
52 flag to extract the package file, and inspect its contents and scripts to
53 ensure it poses no danger to your system's integrity. Pay particular
54 attention to any +INSTALL, +POST-INSTALL, +DEINSTALL, +POST-DEINSTALL,
55 +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS file for
63 directives, and/or use the
65 command to examine the package file.
68 The following command line arguments are supported:
69 .Bl -tag -width indent
70 .It Ar pkg-name Op Ar pkg-name ...
71 The named packages are installed. A package name of - will cause
74 If the packages are not found in the current
77 will search them in each directory named by
80 Turn on verbose output.
82 If a installation scripts (pre-install or post-install) exist for a given
83 package, do not execute them.
85 Don't actually install a package, just report the steps that
86 would be taken if it was.
88 Do not record the installation of a package. This means
89 that you cannot deinstall it later, so only use this option if
90 you know what you are doing!
92 Use the remote fetching feature.
93 This will determine the appropriate
94 objformat and release and then fetch and install the package.
96 Force installation to proceed even if prerequisite packages are not
97 installed or the requirements script fails. Although
99 will still try to find and auto-install missing prerequisite packages,
100 a failure to find one will not be fatal.
104 as the directory in which to extract files from a package.
105 If a package has set its default directory, it will be overridden
106 by this flag. Note that only the first
108 directive will be replaced, since
110 has no way of knowing which directory settings are relative and
111 which are absolute. It is rare in any case to see more than one
112 directory transition made, but when such does happen and you wish
113 to have control over *all* directory transitions, then you
114 may then wish to look into the use of
130 By default, this is the string
131 .Pa /var/tmp/instmp.XXXXXX ,
132 but it may be necessary to override it in the situation where
135 directory is limited. Be sure to leave some number of `X' characters
138 to fill in with a unique ID.
140 You can get a performance boost by setting the staging area
142 to reside on the same disk partition as target directories for package
143 file installation; often this is
148 mode. This is a very specialized mode for running
150 and is meant to be run in conjunction with
152 mode. When run in this mode,
154 does no work beyond extracting the package into a temporary staging
157 option), reading in the packing list, and then dumping it (prefaced by
158 the current staging area) to stdout where it may be filtered by a
161 When used in conjunction with
163 mode, it allows you to make radical changes to the package structure
164 before acting on its contents.
168 mode. This is a very specialized mode for running
170 and is meant to be run in conjunction with
172 mode. When run in this mode,
174 expects the release contents to be already extracted and waiting
175 in the staging area, the location of which is read as a string
176 from stdin. The complete packing list is also read from stdin,
177 and the contents then acted on as normal.
182 arguments may be specified, each being either a file containing the
183 package (these usually end with a
186 URL pointing at a file available on an ftp site. Thus you may
187 extract files directly from their anonymous ftp locations (e.g.\&
189 .Li ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/shells/bash-1.14.7.tgz ) .
190 Note: If you wish to use
194 ftp in such transfers, set
199 to some value in your environment. Otherwise, the more standard
200 ACTIVE mode may be used. If
202 consistently fails to fetch a package from a site known to work,
203 it may be because you have a firewall that demands the usage of
208 .Sh TECHNICAL DETAILS
211 utility is fairly simple. It extracts each package's "packing list"
212 into a special staging directory, parses it,
213 and then runs through the following sequence to fully extract the contents:
216 Check if the package is already recorded as installed. If so,
217 terminate installation.
219 Scan all the package dependencies (from
223 and make sure each one is met. If not, try and find the missing
224 dependencies' packages and auto-install them; if they can't be found
225 the installation is terminated.
229 directives which control how the package is added to the system.
230 At the time of this writing, the only currently implemented option is
231 .Cm @option extract-in-place
232 which will cause the package to be extracted directly into its
233 prefix directory without moving through a staging area in
237 .Cm @option extract-in-place
238 is enabled, the package is now extracted directly into its
239 final location, otherwise it is extracted into the staging area.
241 If the package contains a
245 then execute it with the following arguments:
246 .Bd -ragged -offset indent -compact
252 is the name of the package in question and the
254 keyword denotes this as an installation requirements check (useful if
255 you want to have one script serving multiple functions).
259 script exists for the package, it is then executed with the following
261 .Bd -ragged -offset indent -compact
269 is the name of the package in question and
271 is a keyword denoting this as the preinstallation phase.
276 keyword will not appear if separate scripts for pre-install and post-install
277 are given during package creation time (using the
285 .Cm @option extract-in-place
286 is not used, then the packing list (this is the
288 file) is now used as a guide for moving (or copying, as necessary) files from
289 the staging area into their final locations.
291 If the package contains an
295 then mtree is invoked as:
296 .Bd -ragged -offset indent -compact
308 is either the prefix specified with the
312 flag was specified, the name of the first directory named by a
314 directive within this package.
318 script exists for the package, it is then executed as
319 .Bd -ragged -offset indent -compact
326 is the name of the package in question and
328 is a keyword denoting this as the post-installation phase.
333 keyword will not appear if separate scripts for pre-install and post-install
334 are given during package creation time (using the
341 Reasoning behind passing keywords such as
345 is that this allows you to write a single
347 script that does both
351 functionality is more advantageous and easier from a maintenance viewpoint.
353 After installation is complete, a copy of the packing list,
355 script, description, and display files are copied into
356 .Pa /var/db/pkg/<pkg-name>
357 for subsequent possible use by
359 Any package dependencies are recorded in the other packages'
360 .Pa /var/db/pkg/<other-pkg>/+REQUIRED_BY
362 (if the environment variable PKG_DBDIR is set, this overrides the
366 Finally, the staging area is deleted and the program terminates.
369 All the scripts are called with the environment variable
371 set to the installation prefix (see the
373 option above). This allows a package author to write a script
374 that reliably performs some action on the directory where the package
375 is installed, even if the user might change it with the
382 is used if a given package can't be found. The environment variable
383 should be a series of entries separated by colons. Each entry
384 consists of a directory name.
385 The current directory may be indicated
386 implicitly by an empty directory name, or explicitly by a single
389 The environment variable
391 specifies an alternative location for the installed package database.
393 The environment variables
397 in that order, are taken to name temporary directories where
399 will attempt to create its staging area in.
400 If these variables are not present or if the directories named lack
401 sufficient space, then
403 will use the first of
408 with sufficient space.
410 The environment variable
412 specifies an alternate location for
415 The fetch URL is built using this environment variable and the automatic
421 An example setting would be
422 .Qq Li ftp://ftp3.FreeBSD.org .
424 The environment variable
426 specifies an alternate location for
429 This variable subverts the automatic directory logic
435 Thus it should be a complete URL to the remote package file(s).
437 .Bl -tag -width /var/db/pkg -compact
439 Temporary directory for creating the staging area, if environmental variables
443 do not point to a suitable directory.
447 does not exist or has insufficient space.
453 are not suitable for creating the staging area.
455 Default location of the installed package database.
469 .An John Kohl Aq jtk@rational.com
471 Hard links between files in a distribution are only preserved if either
472 (1) the staging area is on the same file system as the target directory of
473 all the links to the file, or (2) all the links to the file are bracketed by
475 directives in the contents file,
477 the link names are extracted with a single
479 command (not split between
480 invocations due to exec argument-space limitations--this depends on the
482 .Fn sysconf _SC_ARG_MAX ) .