1 .\" $NetBSD: pkg_add.1,v 1.1.1.12 2011/02/18 22:32:28 aymeric Exp $
3 .\" FreeBSD install - a package for the installation and maintenance
4 .\" of non-core utilities.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
25 .Nd a utility for installing and upgrading software package distributions
36 .Ar Oo Oo Li ftp|http Oc Ns Li :// Ns Oo Ar user Oc Ns \
37 Oo Li \&: Ns Ar password Oc \
38 Ns Li @ Oc Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns \
39 Oo Li / Ns Ar path/ Oc Ns Ar pkg-name ...
43 command is used to extract and upgrade packages that have been
44 previously created with the
47 Packages are prepared collections of pre-built binaries, documentation,
48 configurations, installation instructions and/or other files.
50 can recursively install other packages that the current package
51 depends on or requires from both local disk and via FTP or HTTP.
56 command may execute scripts or programs contained within a package file,
57 your system may be susceptible to
60 attacks from miscreants who create dangerous package files.
62 You are advised to verify the competence and identity of those who
63 provide installable package files.
64 For extra protection, use the digital signatures provided where possible
66 .Xr pkg_install.conf 5 ) ,
69 to extract the package file, and inspect its contents and scripts
70 to ensure it poses no danger to your system's integrity.
71 Pay particular attention to any
75 files, and inspect the
85 directives, and/or use the
87 command to examine the package file.
90 The following command line arguments are supported:
91 .Bl -tag -width indent
92 .It Ar pkg-name [ ... ]
93 The named packages are installed.
97 as full URL or path name without any wildcard processing.
100 will try to match packages using wildcard processing.
101 If that fails as well and
103 does not contain any /, the entries of the
105 variable are searched using the wildcard processing rules.
107 Mark package as installed automatically, as dependency of another
110 .Dl Ic pkg_admin set automatic=YES
111 to mark packages this way after installation, and
112 .Dl Ic pkg_admin unset automatic
116 a package without specifying
118 after it had already been automatically installed, the mark is
121 Read the configuration file from
123 instead of the system default.
125 Force installation to proceed even if prerequisite packages are not
126 installed or the install script fails.
129 will still try to find and auto-install missing prerequisite packages,
130 a failure to find one will not be fatal.
131 This flag also overrides the fatal error when the operating system or
132 architecture the package was built on differ from that of the host.
134 Force updating even if the dependencies of depending packages are not
135 satisfied by the new package.
136 This is used by "make replace", after which one would typically
137 replace the depending packages.
139 If an installation script exists for a given package, do not execute it.
140 .It Fl K Ar pkg_dbdir
141 Override the value of the
143 configuration option with the value
146 Don't add the package to any views after installation.
148 Override the machine architecture returned by uname with
151 Don't actually install a package, just report the steps that
152 would be taken if it was.
154 Prefix all file and directory names with
156 For packages without install scripts this has the same behavior as
160 Override the prefix stored in the package with
163 Do not record the installation of a package.
166 This means that you cannot deinstall it later, so only use this option if
167 you know what you are doing!
169 Replace an already installed version from a package.
173 If the package that's being installed is already installed,
174 an update is performed.
175 Installed dependent packages are updated recursively, if they are too
176 old to fulfill the dependencies of the to-be-installed version.
177 See below for a more detailed description of the process.
179 Print version number and exit.
181 Turn on verbose output.
194 arguments may be specified, each being either a file containing the
195 package (these usually ending with the
198 URL pointing at a file available on an ftp or web site.
199 Thus you may extract files directly from their anonymous ftp or WWW
202 ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/shells/bash-3.2.9.tgz
205 http://www.example.org/packages/screen-4.0.tbz).
206 Note: For ftp transfers, if you wish to use
210 ftp in such transfers, set the variable
214 to some value in your environment.
215 Otherwise, the more standard ACTIVE mode may be used.
218 consistently fails to fetch a package from a site known to work,
219 it may be because you have a firewall that demands the usage of
224 .Sh TECHNICAL DETAILS
226 extracts each package's meta data (including the
228 to memory and then runs through the following sequence to fully extract
229 the contents of the package:
230 .Bl -enum -offset indent
232 A check is made to determine if the package or another version of it
233 is already recorded as installed.
235 installation is terminated if the
239 options are not given.
241 If the same version is installed and
243 is not given, it is marked as manually installed and process stops.
246 option is given, it's assumed the package should be replaced by the
248 Before doing so, all packages that depend on the
249 pkg being upgraded are checked if they also work with the new version.
250 If that test is not successful, the dependent packages are updated first.
251 The replacing is then prepared by moving an existing
253 file aside (if it exists), and running
255 on the installed package.
256 Installation then proceeds as if the package
257 was not installed, and restores the
261 The package build information is extracted from the
263 file and compared against the result of
265 If the operating system or architecture of the package differ from
266 that of the host, installation is aborted.
267 This behavior is overridable with the
271 The package build information from
274 .Ev USE_ABI_DEPENDS=NO
276 .Ev IGNORE_RECOMMENDED ) .
277 If the package was built with ABI dependency recommendations ignored,
278 a warning will be issued.
280 A check is made to determine if the package conflicts (from
284 with an already recorded as installed package or if an installed package
285 conflicts with the package.
286 If it is, installation is terminated.
288 The file list of the package is compared to the file lists of the
290 If there is any overlap, the installation is terminated.
292 All package dependencies (from
296 are read from the packing list.
297 If any of these required packages are not currently installed,
298 an attempt is made to find and install it;
299 if the missing package cannot be found or installed,
300 the installation is terminated.
302 If the package contains an
304 script, it is executed with the following arguments:
305 .Bl -tag -width indentindent
307 The name of the package being installed.
309 Keyword denoting that the script is to perform any actions needed before
310 the package is installed.
315 script exits with a non-zero status code, the installation is terminated.
317 The files from the file list are extracted to the chosen prefix.
321 script exists for the package, it is executed with the following arguments:
322 .Bl -tag -width indentindent
324 The name of the package being installed.
326 Keyword denoting that the script is to perform any actions needed
327 after the package has been installed.
330 After installation is complete, a copy of the packing list,
332 script, description, and display files are copied into
333 .Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt]
334 for subsequent possible use by
336 Any package dependencies are recorded in the other packages'
340 If the package is a depoted package, then add it to the registered
345 Finally, if we were upgrading a package, any
347 file that was moved aside before upgrading was started is now moved
353 script is called with the environment variable
355 set to the installation prefix (see the
358 This allows a package author to write a script
359 that reliably performs some action on the directory where the package
360 is installed, even if the user might change it with the
364 The scripts are also called with the
366 environment variable set to the location of the
368 meta-data files, and with the
369 .Ev PKG_REFCOUNT_DBDIR
370 environment variable set to the location of the package reference counts
382 .Ev PKG_REFCOUNT_DBDIR
387 .Xr pkg_install.conf 5
388 for options, that can also be specified using the environment.
389 Packages using views are also affected by the environment variables
395 will try to install binary packages listed in dependencies list.
397 You can specify a compiled binary package explicitly on the command line.
399 # pkg_add /usr/pkgsrc/packages/All/tcsh-6.14.00.tgz
402 If you omit the version number,
404 will install the latest version available.
408 emits more messages to terminal.
410 # pkg_add -v /usr/pkgsrc/packages/All/unzip
413 You can grab a compiled binary package from remote location by specifying
415 The base URL can also be provided by the configuration variable,
418 # pkg_add -v ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/All/firefox-2.0.0.4.tgz
420 # export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/All
428 .Xr pkg_install.conf 5 ,
431 .Bl -tag -width indent -compact
433 Initial work and ongoing development.
439 wildcard dependency processing, pkgdb, upgrading, etc.
442 .It Joerg Sonnenberger
443 Rewrote most of the code base to work without external commands.
446 Package upgrading needs a lot more work to be really universal.