31 lines
711 B
Perl
Executable File
31 lines
711 B
Perl
Executable File
#!/usr/bin/perl -T
|
|
|
|
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
|
|
|
|
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
|
|
|
use strict;
|
|
use warnings;
|
|
use PVE::SafeSyslog;
|
|
use PVE::Service::spiceproxy;
|
|
|
|
$SIG{'__WARN__'} = sub {
|
|
my $err = $@;
|
|
my $t = $_[0];
|
|
chomp $t;
|
|
print STDERR "$t\n";
|
|
syslog('warning', "%s", $t);
|
|
$@ = $err;
|
|
};
|
|
|
|
my $prepare = sub {
|
|
my $rundir="/var/run/pveproxy";
|
|
if (mkdir($rundir, 0700)) { # only works at first start if we are root)
|
|
my $gid = getgrnam('www-data') || die "getgrnam failed - $!\n";
|
|
my $uid = getpwnam('www-data') || die "getpwnam failed - $!\n";
|
|
chown($uid, $gid, $rundir);
|
|
}
|
|
};
|
|
|
|
PVE::Service::spiceproxy->run_cli_handler(prepare => $prepare);
|