diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2006-02-07 11:16:58 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2006-02-07 11:16:58 +0000 |
commit | 2f915553b5f92e91567b3249968c7446a4d60a75 (patch) | |
tree | 7b65325aa283cd7eb18b9dd8f1a675562f5ae0b5 | |
parent | 2cae847550674c81191126619c0dfdfbfd70785a (diff) |
minor independent tweaks:
- make Newuser and Newgroup subclasses of Newauth, so that code can be shared.
- add property type() for these, that expands to user/group
- add property to SpecialFile() that says whether this is executed on
add/delete, so that we can check for noexec fs and error out early on these.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index c8b0287e159..e981847801c 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.79 2005/10/19 10:41:19 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.80 2006/02/07 11:16:57 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -811,10 +811,14 @@ sub add $class->SUPER::add($plist, @args); } -package OpenBSD::PackingElement::NewUser; +package OpenBSD::PackingElement::NewAuth; our @ISA=qw(OpenBSD::PackingElement::Action); + +package OpenBSD::PackingElement::NewUser; +our @ISA=qw(OpenBSD::PackingElement::NewAuth); __PACKAGE__->setKeyword("newuser"); +sub type() { "user" } sub category() { "users" } sub keyword() { "newuser" } @@ -869,10 +873,11 @@ sub stringize($) } package OpenBSD::PackingElement::NewGroup; -our @ISA=qw(OpenBSD::PackingElement::Action); +our @ISA=qw(OpenBSD::PackingElement::NewAuth); __PACKAGE__->setKeyword("newgroup"); +sub type() { "group" } sub category() { "groups" } sub keyword() { "newgroup" } @@ -1205,6 +1210,9 @@ sub destate package OpenBSD::PackingElement::SpecialFile; our @ISA=qw(OpenBSD::PackingElement::Unique); +sub exec_on_add { 0 } +sub exec_on_delete { 0 } + sub add_md5 { my ($self, $md5) = @_; @@ -1236,6 +1244,9 @@ package OpenBSD::PackingElement::ScriptFile; our @ISA=qw(OpenBSD::PackingElement::SpecialFile); use OpenBSD::Error; +sub exec_on_add { 1 } +sub exec_on_delete { 1 } + sub run { my ($self, $state, @args) = @_; @@ -1269,11 +1280,13 @@ sub category() { OpenBSD::PackageInfo::DESC } package OpenBSD::PackingElement::FINSTALL; our @ISA=qw(OpenBSD::PackingElement::ScriptFile); +sub exec_on_delete { 0 } sub category() { OpenBSD::PackageInfo::INSTALL } sub beautify() { "Install" } package OpenBSD::PackingElement::FDEINSTALL; our @ISA=qw(OpenBSD::PackingElement::ScriptFile); +sub exec_on_add { 0 } sub category() { OpenBSD::PackageInfo::DEINSTALL } sub beautify() { "Deinstall" } |