diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-12-27 23:59:45 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-12-27 23:59:45 +0000 |
commit | df66fbb0b5d80ca8548c6e69685cec4440a580c0 (patch) | |
tree | 40e6dd1a2286f4dc9206fe498af74bc39b10903d /usr.sbin | |
parent | 3df9ce6141d49d2c19be1828ec44eb15c03ad533 (diff) |
prepare things slightly further, FwUpdate still not active...
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/Makefile | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 29 |
2 files changed, 22 insertions, 10 deletions
diff --git a/usr.sbin/pkg_add/Makefile b/usr.sbin/pkg_add/Makefile index aeac9c166ec..22fb9c82698 100644 --- a/usr.sbin/pkg_add/Makefile +++ b/usr.sbin/pkg_add/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.83 2014/08/27 18:39:57 kspillner Exp $ +# $OpenBSD: Makefile,v 1.84 2014/12/27 23:59:44 espie Exp $ .include <bsd.own.mk> @@ -66,6 +66,7 @@ PACKAGES= \ OpenBSD/UpdateSet.pm \ OpenBSD/Ustar.pm \ OpenBSD/Vstat.pm \ + OpenBSD/FwUpdate.pm \ OpenBSD/md5.pm \ OpenBSD/signify.pm \ OpenBSD/x509.pm diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index b5e066597c9..a2da3b6d87d 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.482 2014/01/23 11:45:22 espie Exp $ +# $OpenBSD: pkg_add,v 1.483 2014/12/27 23:59:44 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -21,21 +21,32 @@ use warnings; sub run { - my ($cmd, $name) = @_; - my $module = "OpenBSD::Pkg\u$cmd"; - eval "require $module;"; + my ($cmd, $m) = @_; + my $module = "OpenBSD::$m"; + eval "require $module"; if ($@) { die $@; } - exit($module->parse_and_run($name)); + exit($module->parse_and_run($cmd)); } + +my $choices = { + pkg_add => 'PkgAdd', + pkg_check => 'PkgCheck', + pkg_create => 'PkgCreate', + pkg_delete => 'PkgDelete', + pkg_info => 'PkgInfo', + pkg_sign => 'PkgSign', + fw_update => 'FwUpdate', +}; + my @l = qw(add check create delete info sign); -for my $i (@l) { - if ($0 =~ m/\/?pkg_$i$/) { - run($i, "pkg_$i"); +while (my ($cmd, $module) = each %$choices) { + if ($0 =~ m/\/?\Q$cmd\E$/) { + run($cmd, $module); } } # defaults to pkg_info personality but keeps the command name -run('info', $0); +run($0, 'PkgInfo'); |