+sub run {
+ my ($class, $pwcallback, $preparefunc) = @_;
+
+ $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+
+ no strict 'refs';
+ $cmddef = ${"${class}::cmddef"};
+
+ $exename = $class;
+ $exename =~ s/^.*:://;
+
+ initlog($exename);
+
+ 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');
+
+ my $cmd = shift @ARGV;
+
+ handle_cmd($cmddef, $exename, $cmd, \@ARGV, $pwcallback, $0, $preparefunc);
+
+ exit 0;
+}
+