From 9a75ae2f447ba6fc84c5a0ec8444cdc0b3a650f0 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 11 Nov 2004 11:16:41 +0000 Subject: introduce shortcuts to read/write contents from_installation/to_installation use these to simplify all those packing lists manipulations. demote non-root detection to a warning in -n mode: fix a couple of minor bugs, of stuff that was run in -n mode and should not. Namely, manpages were indexed/unindexed (ouch) and tempfiles were creating during updates. --- usr.sbin/pkg_add/pkg_delete | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'usr.sbin/pkg_add/pkg_delete') diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index 2e4eb435780..740bf41ace1 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.70 2004/11/11 10:47:26 espie Exp $ +# $OpenBSD: pkg_delete,v 1.71 2004/11/11 11:16:39 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -58,10 +58,6 @@ if ($opt_f) { %forced = map {($_, 1)} split(/,/, $opt_f); } -if ($< && !$forced{nonroot}) { - Fatal "$0 must be run as root"; -} - my %done; my $removed; @@ -79,6 +75,14 @@ if ($opt_x && $state->{beverbose}) { OpenBSD::ProgressMeter::enable(); } +if ($< && !$forced{nonroot}) { + if ($state->{not}) { + print "$0 should be run as root\n"; + } else { + Fatal "$0 must be run as root"; + } +} + # First, resolve pkg names my @realnames; @@ -172,7 +176,6 @@ eval { "$pkgname\n"; } $state->set_pkgname($pkgname); - $state->{pkgname_tolog} = $pkgname; OpenBSD::Delete::delete_package($pkgname, $state); delete_installed($pkgname); $done{$pkgname} = 1; -- cgit v1.2.3