diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-27 11:36:17 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-27 11:36:17 +0000 |
commit | 4e856b2e517446073ed13ca7b3a7d89fa4c23e91 (patch) | |
tree | b3cfc504986e8db66891a9b8e5534259bcc7b702 /usr.sbin | |
parent | 7ee77913543e58e75d18b0bb5bb7dabcba6b5e3e (diff) |
be verbose if !extra, tell user what they should do manually.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 42 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/SharedItems.pm | 38 |
2 files changed, 46 insertions, 34 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index ce6a7fcd8af..b491f66dfde 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.11 2004/11/21 13:32:18 espie Exp $ +# $OpenBSD: Delete.pm,v 1.12 2004/11/27 11:36:16 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -189,7 +189,7 @@ sub delete $state->{groups_to_rm} = {} unless defined $state->{groups_to_rm}; my $h = $state->{groups_to_rm}; - $h->{$name} = 1; + $h->{$name} = $state->{pkgname}; } package OpenBSD::PackingElement::DirBase; @@ -284,23 +284,21 @@ sub delete } my $origname = $state->{destdir}.$orig->fullname(); if (! -e $realname) { - print "File $realname does not exist\n"; + $state->print("File $realname does not exist\n"); return; } if (! -f $realname) { - print "File $realname is not a file\n"; + $state->print("File $realname is not a file\n"); return; } if (!defined $orig->{md5}) { - print "Problem: file $name does not have an md5 checksum\n"; - print "NOT deleting: $realname\n"; $state->print("Couldn't delete $realname (no md5)\n"); return; } if ($state->{quick}) { unless ($state->{extra}) { - print "NOT deleting file $realname\n"; + $state->print("You should also remove $realname\n"); return; } } else { @@ -308,9 +306,8 @@ sub delete if ($md5 eq $orig->{md5}) { print "File $realname identical to sample\n" if $state->{not} or $state->{verbose}; } else { - print "File $realname NOT identical to sample\n"; unless ($state->{extra}) { - print "NOT deleting $realname\n"; + $state->print("You should also remove $realname (which was modified)\n"); return; } } @@ -369,16 +366,19 @@ package OpenBSD::PackingElement::Extra; sub delete { my ($self, $state) = @_; - return unless $state->{extra}; my $name = $self->fullname(); my $realname = $state->{destdir}.$name; - if ($state->{beverbose}) { + if ($state->{beverbose} && $state->{extra}) { print "deleting extra file: $realname\n"; } return if $state->{not}; return unless -e $realname; - unlink($realname) or - print "problem deleting extra file $realname\n"; + if ($state->{extra}) { + unlink($realname) or + print "problem deleting extra file $realname\n"; + } else { + $state->print("You should also remove $realname\n"); + } } package OpenBSD::PackingElement::Extradir; @@ -386,8 +386,12 @@ sub delete { my ($self, $state) = @_; return unless $state->{extra}; - return unless -e $state->{destdir}.$self->fullname(); - $self->SUPER::delete($state); + my $realname = $state->{destdir}.$self->fullname(); + if ($state->{extra}) { + $self->SUPER::delete($state); + } else { + $state->print("You should also remove the directory $realname\n"); + } } package OpenBSD::PackingElement::ExtraUnexec; @@ -395,9 +399,11 @@ package OpenBSD::PackingElement::ExtraUnexec; sub delete { my ($self, $state) = @_; - return unless $state->{extra}; - - $self->run($state); + if ($state->{extra}) { + $self->run($state); + } else { + $state->print("You should also run ", $self->{expanded}, "\n"); + } } package OpenBSD::PackingElement::Lib; diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm index bfac3645fba..31a56f170a8 100644 --- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm +++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SharedItems.pm,v 1.3 2004/11/11 11:16:40 espie Exp $ +# $OpenBSD: SharedItems.pm,v 1.4 2004/11/27 11:36:16 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -55,10 +55,8 @@ sub cleanup OpenBSD::ProgressMeter::set_header("Clean shared items"); my $total = 0; $total += keys %$h if defined $h; - if ($state->{extra}) { - $total += keys %$u if defined $u; - $total += keys %$g if defined $g; - } + $total += keys %$u if defined $u; + $total += keys %$g if defined $g; my $done = 0; if (defined $h) { @@ -82,22 +80,30 @@ sub cleanup $done++; } } - if ($state->{extra}) { - if (defined $u) { - for my $user (keys %$u) { - OpenBSD::ProgressMeter::show($done, $total); - next if $remaining->{users}->{$user}; + if (defined $u) { + while (my ($user, $pkgname) = each %$u) { + OpenBSD::ProgressMeter::show($done, $total); + next if $remaining->{users}->{$user}; + if ($state->{extra}) { System("/usr/sbin/userdel", $user); - $done++; + } else { + $state->set_pkgname($pkgname); + $state->print("You should also run /usr/sbin/userdel $user\n"); } + $done++; } - if (defined $g) { - for my $group (keys %$g) { - OpenBSD::ProgressMeter::show($done, $total); - next if $remaining->{groups}->{$group}; + } + if (defined $g) { + while (my ($group, $pkgname) = each %$g) { + OpenBSD::ProgressMeter::show($done, $total); + next if $remaining->{groups}->{$group}; + if ($state->{extra}) { System("/usr/sbin/groupdel", $group); - $done++; + } else { + $state->set_pkgname($pkgname); + $state->print("You should also run /usr/sbin/groupdel $group\n"); } + $done++; } } OpenBSD::ProgressMeter::next(); |