From: espie Date: Sat, 27 Dec 2014 23:59:44 +0000 (+0000) Subject: prepare things slightly further, FwUpdate still not active... X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e88ecaa298162de3f336441fc8d61a66d0b41ef0;p=openbsd prepare things slightly further, FwUpdate still not active... --- 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 @@ -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 # @@ -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');