mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
compiler_vm: update server scripts
This commit is contained in:
parent
9707e133ff
commit
d702427ad1
@ -7,15 +7,13 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use English;
|
||||
use File::Basename;
|
||||
use JSON;
|
||||
|
||||
my $USERNAME = 'compiler';
|
||||
my $USE_LOCAL = defined $ENV{'CC_LOCAL'};
|
||||
|
||||
# uncomment the following if installed to the virtual machine
|
||||
# use constant MOD_DIR => '/usr/local/share/compiler_vm/languages';
|
||||
|
||||
use constant MOD_DIR => '/usr/local/share/compiler_vm/languages';
|
||||
|
||||
use lib MOD_DIR;
|
||||
@ -108,25 +106,32 @@ sub run_server {
|
||||
}
|
||||
|
||||
if ($pid == 0) {
|
||||
my ($uid, $gid) = (getpwnam $USERNAME)[2, 3];
|
||||
my ($uid, $gid, $home) = (getpwnam $USERNAME)[2, 3, 7];
|
||||
if (not $uid and not $gid) {
|
||||
print "Could not find user $USERNAME: $!\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($compile_in->{'persist-key'}) {
|
||||
system ("rm -rf \"/home/compiler/$compile_in->{'persist-key'}\"");
|
||||
system("mount /dev/vdb1 /root/factdata");
|
||||
system("mkdir /root/factdata/$compile_in->{'persist-key'}");
|
||||
system("cp -R -p /root/factdata/$compile_in->{'persist-key'}/* /home/compiler/");
|
||||
system("mkdir -p \"/root/factdata/$compile_in->{'persist-key'}\"");
|
||||
system("cp -R -p \"/root/factdata/$compile_in->{'persist-key'}\" \"/home/compiler/$compile_in->{'persist-key'}\"");
|
||||
}
|
||||
|
||||
system("chmod -R 755 /home/compiler");
|
||||
system("chown -R compiler /home/compiler/*");
|
||||
system("chgrp -R compiler /home/compiler/*");
|
||||
system("chown -R compiler /home/compiler");
|
||||
system("chgrp -R compiler /home/compiler");
|
||||
system("rm -rf /home/compiler/prog*");
|
||||
system("pkill -u compiler");
|
||||
|
||||
$( = $gid;
|
||||
$< = $uid;
|
||||
$ENV{USER} = $USERNAME;
|
||||
$ENV{LOGNAME} = $USERNAME;
|
||||
$ENV{HOME} = $home;
|
||||
|
||||
$GID = $gid;
|
||||
$EGID = "$gid $gid";
|
||||
$EUID = $UID = $uid;
|
||||
|
||||
my $result = interpret(%$compile_in);
|
||||
|
||||
@ -142,9 +147,9 @@ sub run_server {
|
||||
|
||||
if ($compile_in->{'persist-key'}) {
|
||||
system("id");
|
||||
system("cp -R -p /home/compiler/* /root/factdata/$compile_in->{'persist-key'}/");
|
||||
system("cp -R -p \"/home/compiler/$compile_in->{'persist-key'}\" \"/root/factdata/$compile_in->{'persist-key'}\"");
|
||||
system("umount /root/factdata");
|
||||
system ("rm -rf /home/compiler/*");
|
||||
system ("rm -rf \"/home/compiler/$compile_in->{'persist-key'}\"");
|
||||
}
|
||||
|
||||
exit;
|
||||
|
@ -100,7 +100,7 @@ sub execute {
|
||||
next;
|
||||
}
|
||||
|
||||
if($line =~ m/^Reading symbols from.*done\.$/) {
|
||||
if($line =~ m/^Reading symbols from/) {
|
||||
gdb $in, "break gdb\n";
|
||||
|
||||
gdb $in, "list main,9001\n";
|
||||
|
Loading…
Reference in New Issue
Block a user