diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2011-01-23 06:56:54 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2011-01-23 06:56:54 +0000 |
commit | 1ec7cd16b8364beafeefbcc375736eb7b208802a (patch) | |
tree | 2b26d777958111ceb52f3e5feae0b8624e42773a /usr.sbin/pkg_add | |
parent | 307a2a0cc3f0272edc54cc84f2aac346bdf6f89a (diff) |
hide details of "finish" inside PackingElement proper.
do the font dirs, also display a message for new installed rcscripts, and
if some stuff has been added to the readmes directory.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 13 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 32 |
4 files changed, 54 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index d92f139a6bd..7fce8996b00 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.120 2011/01/21 20:37:26 espie Exp $ +# $OpenBSD: Add.pm,v 1.121 2011/01/23 06:56:53 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -374,6 +374,9 @@ sub install $self->SUPER::install($state); my $fullname = $self->fullname; my $destdir = $state->{destdir}; + if ($fullname =~ m,^/usr/local/share/doc/pkg-readmes/,) { + $state->{readmes}++; + } if ($state->{extracted_first}) { if ($state->{not}) { @@ -457,6 +460,14 @@ sub prepare_to_extract return $file; } +package OpenBSD::PackingElement::RcScript; +sub install +{ + my ($self, $state) = @_; + $state->{add_rcscripts}{$self->fullname} = 1; + $self->SUPER::install($state); +} + package OpenBSD::PackingElement::EndFake; sub install { diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 20fdc831908..18821bcdbe2 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.44 2010/12/29 13:03:05 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.45 2011/01/23 06:56:53 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -65,7 +65,7 @@ sub framework # cleanup various things $state->{recorder}->cleanup($state); $state->ldconfig->ensure; - OpenBSD::PackingElement::Fontdir::finish_fontdirs($state); + OpenBSD::PackingElement->finish($state); $state->progress->clear; $state->log->dump; $self->finish_display($state); diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index ad1087ab532..98b24d5480f 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.112 2010/12/24 09:09:54 espie Exp $ +# $OpenBSD: Delete.pm,v 1.113 2011/01/23 06:56:53 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -270,6 +270,16 @@ sub mark_dir $self->mark_directory($state, $self->fullname); } +package OpenBSD::PackingElement::RcScript; +# XXX we should check stuff more thoroughly + +sub delete +{ + my ($self, $state) = @_; + $state->{delete_rcscripts}{$self->fullname} = 1; + $self->SUPER::delete($state); +} + package OpenBSD::PackingElement::NewUser; sub delete { diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 52823e27d57..41b7b864bcf 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.192 2011/01/14 14:32:18 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.193 2011/01/23 06:56:53 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -165,6 +165,16 @@ sub copy_deep_if $self->clone->add_object($copy) if defined $h->{$self}; } +sub finish +{ + my ($class, $state) = @_; + OpenBSD::PackingElement::Fontdir->finish($state); + OpenBSD::PackingElement::RcScript->report($state); + if ($state->{readmes}) { + $state->say("Look in /usr/local/share/doc/pkg-readmes for extra documentation"); + } +} + # Basic class hierarchy # various stuff that's only linked to objects before/after them @@ -484,6 +494,22 @@ sub destate $self->compute_modes($state); } +sub report +{ + my ($class, $state) = @_; + + my @l; + for my $script (sort keys %{$state->{add_rcscripts}}) { + next if $state->{delete_rcscripts}{$script}; + push(@l, $script); + } + if (@l > 0) { + $state->say("The following new rcscripts were installed: #1", + join(' ', @l)); + $state->say("See rc.d(8) for details"); + } +} + package OpenBSD::PackingElement::InfoFile; our @ISA=qw(OpenBSD::PackingElement::FileBase); @@ -1453,9 +1479,9 @@ sub run_if_exists } } -sub finish_fontdirs +sub finish { - my $state = shift; + my ($class, $state) = @_; my @l = keys %fonts_todo; if (@l != 0) { require OpenBSD::Error; |