From a8a4cd644524260e314ef7906aaf3c0fb1143152 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 27 May 2015 09:30:54 +0200 Subject: [PATCH] non-root buildfix --- pveum | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pveum b/pveum index 55ad1f4..a80b4de 100755 --- a/pveum +++ b/pveum @@ -29,19 +29,6 @@ initlog('pveum'); #fixme: logging? -die "please run as root\n" if $> != 0; - -PVE::INotify::inotify_init(); - -my $rpcenv = PVE::RPCEnvironment->init('cli'); - -$rpcenv->init_request(); -$rpcenv->set_language($ENV{LANG}); -$rpcenv->set_user('root@pam'); - -# autmatically generate the private key if it does not already exists -PVE::Cluster::gen_auth_key(); - my $read_password = sub { # return $ENV{PVE_PW_TICKET} if defined($ENV{PVE_PW_TICKET}); @@ -82,6 +69,21 @@ my $cmddef = { my $cmd = shift; +if ($cmd ne 'verifyapi' && $cmd ne 'printmanpod') { + die "please run as root\n" if $> != 0; + + PVE::INotify::inotify_init(); + + my $rpcenv = PVE::RPCEnvironment->init('cli'); + + $rpcenv->init_request(); + $rpcenv->set_language($ENV{LANG}); + $rpcenv->set_user('root@pam'); + +# autmatically generate the private key if it does not already exists + PVE::Cluster::gen_auth_key(); +} + PVE::CLIHandler::handle_cmd($cmddef, "pveum", $cmd, \@ARGV, $read_password, $0); exit 0; -- 2.39.2