summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-01-27 13:09:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-01-27 13:09:17 +0000
commitab081698ea98fb1682bb4849ce7cadd710477b64 (patch)
tree1057114878daf8dd6bde29684393c4c17702a3a3
parent14abf12ccd1f8ef2aabdd896b86ef04604755727 (diff)
-f framework, manpage fixes.
comments and okay jmc@
-rw-r--r--usr.sbin/pkg_add/pkg_add11
-rw-r--r--usr.sbin/pkg_add/pkg_add.155
-rw-r--r--usr.sbin/pkg_add/pkg_delete10
-rw-r--r--usr.sbin/pkg_add/pkg_delete.163
4 files changed, 94 insertions, 45 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 5a7b700ed96..b891a77ccc0 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.22 2004/01/22 21:11:43 espie Exp $
+# $OpenBSD: pkg_add,v 1.23 2004/01/27 13:09:16 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -38,6 +38,8 @@ use OpenBSD::Vstat;
use Getopt::Std;
use File::Copy;
+our %forced = ();
+
# XXX we don't want to load this package all the time
package OpenBSD::RequiredBy;
our $AUTOLOAD;
@@ -118,8 +120,11 @@ package main;
my $errors = 0;
-our ($opt_v, $opt_n, $opt_I);
-getopts('vnI');
+our ($opt_v, $opt_n, $opt_I, $opt_f);
+getopts('vnIf:');
+if ($opt_f) {
+ %forced = map {($_, 1)} split(/,/, $opt_f);
+}
my $conflict_list = {};
diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1
index 683a3574e95..ad46f9612da 100644
--- a/usr.sbin/pkg_add/pkg_add.1
+++ b/usr.sbin/pkg_add/pkg_add.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_add.1,v 1.7 2004/01/22 21:11:43 espie Exp $
+.\" $OpenBSD: pkg_add.1,v 1.8 2004/01/27 13:09:16 espie Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -25,12 +25,13 @@
.Nd install software package distributions
.Sh SYNOPSIS
.Nm pkg_add
-.Op Fl vIn
+.Op Fl Inv
+.Op Fl f Ar keys
.Ar pkg-name Op Ar ...
.Sh DESCRIPTION
The
.Nm
-command is used to extract packages that have been previously created
+command is used to install packages created
with the
.Xr pkg_create 1
command.
@@ -41,8 +42,6 @@ tree can be found on the
FTP site or on the official
.Ox
CD.
-These packages are provided as a convenience for quickly installing software
-that would otherwise need to be built manually.
.Bd -filled -offset indent
.Em Note :
System distribution files, e.g. base28.tgz, comp28.tgz, etc., are
@@ -70,6 +69,13 @@ as a package name causes
.Nm
to read from the standard input.
.Pp
+Some packages may depend on other packages.
+When resolving dependencies
+.Nm
+will first look at already installed packages, then match
+dependencies with the list of packages left to install, then
+install default packages that satisfy the dependencies.
+.Pp
Alternatively, it is possible to add packages interactively from within
the ftp client,
in which case setting
@@ -105,7 +111,7 @@ or other subtle attacks from miscreants who create dangerous packages.
Be sure the specified package(s) are from trusted sources.
.Pp
The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width keyword
.It Fl v
Turn on verbose output.
.It Fl I
@@ -113,6 +119,11 @@ If an installation script exists for a given package, do not execute it.
.It Fl n
Don't actually install a package, just report the steps that
would be taken if it was.
+.It Fl f Ar keys
+Force installation of the package.
+.Ar keys
+is a comma-separated list of keywords that state what failsafes
+should be waived.
.El
.Pp
By default, when adding packages via FTP, the
@@ -158,7 +169,7 @@ directives, see
with an already recorded as installed package.
If it is, installation is terminated.
.It
-For packages tagged with architecture constraints,
+For packages tagged with architecture constraints,
.Nm
verifies that the current machine architecture agrees with the constraints.
.It
@@ -171,10 +182,16 @@ directives, see
.Xr pkg_create 1 )
are read from the packing list.
If any of these dependencies are not currently fullfilled,
-an attempt is made to find a package that meets them and install it;
+an attempt is made to find a package that meets them and install it,
+looking first in the list of packages to install passed to
+.Nm ;
if no adequate package can be found and installed,
the installation is terminated.
.It
+.Nm
+checks for collisions with installed file names, read-only file systems,
+and enough space to store files.
+.It
If the package contains a
.Ar require
script (see
@@ -240,6 +257,12 @@ path shown above).
Finally, the staging area is deleted and the program terminates.
.El
.Pp
+Note that it is safe to interrupt
+.Nm pkg_add
+through
+.Dv SIGINT ,
+as it will safely record an interrupted install as
+.Pa borked.n .
.Sh ENVIRONMENT
.Bl -tag -width PKG_TMPDIR
.It Ev PKG_PATH
@@ -282,11 +305,21 @@ can hold executable scripts.
.El
.Pp
.Nm
-looks through ${PKG_TMPDIR}, ${TMPDIR}, /var/tmp, /tmp, /usr/tmp
+looks through
+.Ev ${PKG_TMPDIR} ,
+.Ev ${TMPDIR} ,
+.Pa /var/tmp ,
+.Pa /tmp ,
+.Pa /usr/tmp
for such an area, in sequence.
.Pp
-If ${TMPDIR} and /var/tmp are mounted noexec, you must set PKG_TMPDIR
+If
+.Ev ${TMPDIR}
+and
+.Pa /var/tmp
+are mounted noexec, you must currently set
+.Ev PKG_TMPDIR
to a suitable area, as
.Nm
-has no way to check for noexec status except by failing to run installation
+does not check for noexec status except by failing to run installation
scripts.
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index e3be8a72329..5c4dd6aada4 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.18 2004/01/27 00:13:04 espie Exp $
+# $OpenBSD: pkg_delete,v 1.19 2004/01/27 13:09:16 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -34,6 +34,8 @@ use OpenBSD::RequiredBy;
use OpenBSD::Logger;
use OpenBSD::Vstat;
+our %forced = ();
+
package OpenBSD::PackingElement;
sub delete
{
@@ -312,7 +314,7 @@ sub delete_package
remove_packing_info($dir) unless $opt_n;
}
-getopts('vcDdnfqpS:');
+getopts('vcDdnf:qpS:');
if (defined $opt_p) {
die "Option p is obsolete";
@@ -321,6 +323,10 @@ if (defined $opt_d) {
die "Option d is obsolete";
}
+if ($opt_f) {
+ %forced = map {($_, 1)} split(/,/, $opt_f);
+}
+
my %done;
my $removed;
diff --git a/usr.sbin/pkg_add/pkg_delete.1 b/usr.sbin/pkg_add/pkg_delete.1
index 0d328392a8f..e9251c1f9de 100644
--- a/usr.sbin/pkg_add/pkg_delete.1
+++ b/usr.sbin/pkg_add/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_delete.1,v 1.3 2003/11/14 23:03:55 espie Exp $
+.\" $OpenBSD: pkg_delete.1,v 1.4 2004/01/27 13:09:16 espie Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -25,8 +25,9 @@
.Nd a utility for deleting previously installed software package distributions
.Sh SYNOPSIS
.Nm pkg_delete
-.Op Fl cvDnfq
-.Ar pkg-name Op Ar ...
+.Op Fl cDnqv
+.Op Fl f Ar keys
+.Ar pkgname Op Ar ...
.Sh DESCRIPTION
The
.Nm
@@ -35,18 +36,22 @@ with the
.Xr pkg_add 1
command.
.Pp
-Package names may be specified either as the package name itself, or as filenames which consist of the package name plus the
+Package names may be specified either as the package name itself, or as a
+filename which consists of the package name plus the
.Dq .tgz
-,
-.Dq .tar.gz
-, or the
-.Dq .tar
-suffix.
+suffix, or as a full pathname like
+.Pa /var/db/pkg/pkgname ,
+so that shell wildcards can be used.
+.Pp
+Version numbers and flavors
+.Po
+see
+.Xr packages-specs 7
+.Pc
+can be omitted, unless the resulting specification is ambiguous.
.Pp
The options are as follows:
-.Bl -tag -width Ds
-.It Ar pkg-name Op Ar ...
-The named packages are deinstalled.
+.Bl -tag -width keyword
.It Fl v
Turn on verbose output.
.It Fl D
@@ -54,9 +59,11 @@ If a deinstallation script exists for a given package, do not execute it.
.It Fl n
Don't actually deinstall a package, just report the steps that
would be taken if it were.
-.It Fl f
-Force removal of the package, even if a dependency is recorded or the
-deinstall or require script fails.
+.It Fl f Ar keys
+Force removal of the package.
+.Ar keys
+is a comma-separated list of keywords that state what failsafes
+should be waived.
.It Fl c
Delete extra configuration file, mentioned as
.Bd -literal
@@ -68,17 +75,17 @@ Delete package quickly, do not bother checking md5s before removing files.
.El
.Sh TECHNICAL DETAILS
.Nm
-does pretty much what it says.
-It examines installed package records in
-.Pa /var/db/pkg/<pkg-name> ,
-deletes the package contents, and finally removes the package records.
+examines installed package records for the
+.Ar pkgname
+specified, checks inter-dependencies between installed packages,
+deletes the package contents in an order respecting dependencies
+(e.g., packages with dependencies get removed first), and finally
+removes the package records.
.Pp
-If a package is required by other installed packages,
+If a package is required by other installed packages not mentioned in
+the list of packages to remove,
.Nm
-will list those dependent packages and refuse to delete the package
-(unless the
-.Fl f
-option is given).
+will list those dependent packages and refuse to delete the package.
.Pp
If the package contains a
.Ar require
@@ -92,7 +99,7 @@ then this is executed first as
.Ed
.Pp
(where
-.Ar pkg-name
+.Ar pkgname
is the name of the package in question and
.Ar DEINSTALL
is a keyword denoting that this is a deinstallation)
@@ -104,10 +111,8 @@ option is specified.
If a
.Cm deinstall
script exists for the package, it is executed before any files are removed.
-It is this script's responsibility to clean up any additional messy details
-around the package's installation, since all
-.Nm
-knows how to do is delete the files created in the original distribution.
+Such a script can be used to remove messy dynamic files created by the
+package on installation or during usage.
The
.Nm deinstall
script is called as: