diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-01-27 15:34:32 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-01-27 15:34:32 +0000 |
commit | 95302659848f005f2a4cc00f3dc1347f0e791138 (patch) | |
tree | 38f63dce7bd19094436e0fac41cc7daff272558c /usr.sbin/pkg_add | |
parent | 644a222f2b8eadba27b873d39ed3507a1b789adb (diff) |
more forced keywords.
`looks sane' henning@
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete | 53 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete.1 | 10 |
2 files changed, 40 insertions, 23 deletions
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index b4b7a2e9839..cd68e221319 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.20 2004/01/27 14:50:52 espie Exp $ +# $OpenBSD: pkg_delete,v 1.21 2004/01/27 15:34:31 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -347,26 +347,29 @@ my @realnames; my $bad; for my $pkgname (@ARGV) { - $pkgname =~ s/\.tgz$//; - unless (is_installed($pkgname)) { - if (OpenBSD::PackageName::is_stem($pkgname)) { - my @l = OpenBSD::PackageName::findstem($pkgname, - installed_packages()); - if (@l == 1) { - $pkgname = $l[0]; - } elsif (@l != 0) { - print "Ambiguous: $pkgname could be ", join(' ', @l),"\n"; + $pkgname =~ s/\.tgz$//; + if (is_installed($pkgname)) { + push(@realnames, installed_name($pkgname)); + } else { + if (OpenBSD::PackageName::is_stem($pkgname)) { + my @l = OpenBSD::PackageName::findstem($pkgname, + installed_packages()); + if (@l == 0) { + print "Can't resolve $pkgname to an installed package name\n"; + $bad = 1 unless $forced{uninstalled}; + } elsif (@l == 1) { + push(@realnames, $l[0]); + } elsif (@l != 0) { + print "Ambiguous: $pkgname could be ", join(' ', @l),"\n"; + if ($forced{ambiguous}) { + print "(removing them all)\n"; + push(@realnames, @l); + } else { $bad = 1; - next; } } } - if (is_installed($pkgname)) { - push(@realnames, installed_name($pkgname)); - } else { - print "Can't resolve $pkgname to an installed package name\n"; - $bad = 1; - } + } } # Then check that dependencies are okay @@ -388,14 +391,22 @@ while (my $pkgname = pop @todo) { next if defined $extra_rm{$dep}; $extra_rm{$dep}=$pkgname; push(@todo, $dep); - $bad = 1; } } } -if ($bad) { + +if (keys(%extra_rm) != 0) { print "Can't remove ", join(' ', @ARGV), " without also removing:\n", - join(' ', keys(%extra_rm)), "\n" - if keys(%extra_rm) != 0; + join(' ', keys(%extra_rm)), "\n"; + if ($forced{dependencies}) { + print "(removing them as well)\n"; + push(@realnames, keys(%extra_rm)); + } else { + $bad = 1; + } +} + +if ($bad) { exit(1); } diff --git a/usr.sbin/pkg_add/pkg_delete.1 b/usr.sbin/pkg_add/pkg_delete.1 index d641659780b..0cef5043e4c 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.5 2004/01/27 14:50:52 espie Exp $ +.\" $OpenBSD: pkg_delete.1,v 1.6 2004/01/27 15:34:31 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -66,8 +66,14 @@ is a comma-separated list of keywords that state what failsafes should be waived. These include: .Bl -tag -width keyword +.It Ar ambiguous +delete all packages matching ambiguous package specifications. +.It Ar dependencies +also delete the whole set of packages that depends upon the requested packages. .It Ar nonroot -install even if not running as root. +uninstall even if not running as root. +.It Ar uninstalled +proceed even if some package names don't resolve to installed package names. .El .It Fl c Delete extra configuration file, mentioned as |