diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-10-11 14:40:05 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-10-11 14:40:05 +0000 |
commit | e410dc9a72e5c5e72032f73f13696984ef0074b6 (patch) | |
tree | e7896c60cc5662f049c3e4cad6bbe0e94e3c797d | |
parent | 96490bc36bb2e66eef261222453ebe91297212c6 (diff) |
common code for exec/unexec/extraunexec.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete | 19 |
3 files changed, 16 insertions, 21 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 8a5711f1588..018fefa9977 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.52 2004/10/11 14:35:08 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.53 2004/10/11 14:40:04 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -863,6 +863,7 @@ sub destate package OpenBSD::PackingElement::ExeclikeAction; use File::Basename; +use OpenBSD::Error; our @ISA=qw(OpenBSD::PackingElement::Action); sub expand @@ -894,6 +895,15 @@ sub destate $self->{expanded} = $self->expand($self->{name}, $state); } +sub run +{ + my ($self, $state) = @_; + + main::ensure_ldconfig($state); + print $self->keyword(), " ", $self->{expanded}, "\n" if $state->{beverbose}; + System('/bin/sh', '-c', $self->{expanded}) unless $state->{not}; +} + package OpenBSD::PackingElement::Exec; our @ISA=qw(OpenBSD::PackingElement::ExeclikeAction); diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index fc5895a048d..44f16b9daa6 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.73 2004/10/11 14:35:07 espie Exp $ +# $OpenBSD: pkg_add,v 1.74 2004/10/11 14:40:04 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -293,9 +293,7 @@ sub install { my ($self, $state) = @_; - main::ensure_ldconfig($state); - print "exec ", $self->{expanded}, "\n" if $state->{beverbose}; - System('/bin/sh', '-c', $self->{expanded}) unless $state->{not}; + $self->run($state); } package OpenBSD::PackingElement::Lib; diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index e47528e8205..78f6388928c 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.55 2004/10/11 14:35:08 espie Exp $ +# $OpenBSD: pkg_delete,v 1.56 2004/10/11 14:40:04 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -208,18 +208,11 @@ sub delete } package OpenBSD::PackingElement::Unexec; -use OpenBSD::Error; sub delete { my ($self, $state) = @_; - my $cmd = $self->{expanded}; - main::ensure_ldconfig($state); - if ($state->{beverbose}) { - print "unexec: $cmd\n"; - } - return if $state->{not}; - System('/bin/sh', '-c', $cmd); + $self->run($state); } package OpenBSD::PackingElement::FileBase; @@ -428,13 +421,7 @@ sub delete my ($self, $state) = @_; return unless $state->{extra}; - my $cmd = $self->{expanded}; - main::ensure_ldconfig($state); - if ($state->{beverbose}) { - print "unexec: $cmd\n"; - } - return if $state->{not}; - System($cmd); + $self->run($state); } package OpenBSD::PackingElement::Lib; |