mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 06:52:39 +00:00
🆑 coiax rscadd: Admins are now notified if a megafauna uses a wormhole or a shuttle. rscadd: A new Shuttle Manipulator verb has been added for quick access to probably the best and most bugfree feature on /tg/. /🆑 Megafauna adminnotifies on portal TP Standard shuttle names and logging Also ignore .mdme files Muh commit Actually works and stuff
85 lines
2.0 KiB
Python
Executable File
85 lines
2.0 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import subprocess
|
|
import os
|
|
import sys
|
|
import argparse
|
|
from subprocess import PIPE, STDOUT
|
|
|
|
null = open("/dev/null", "wb")
|
|
|
|
def wait(p):
|
|
rc = p.wait()
|
|
if rc != 0:
|
|
p = play("sound/misc/compiler-failure.ogg")
|
|
p.wait()
|
|
assert p.returncode == 0
|
|
sys.exit(rc)
|
|
|
|
def play(soundfile):
|
|
p = subprocess.Popen(["play", soundfile], stdout=null, stderr=null)
|
|
assert p.wait() == 0
|
|
return p
|
|
|
|
def stage1():
|
|
p = subprocess.Popen("(cd tgui; /bin/bash ./build.sh)", shell=True)
|
|
wait(p)
|
|
play("sound/misc/compiler-stage1.ogg")
|
|
|
|
def stage2(map):
|
|
if map:
|
|
txt = "-M{}".format(map)
|
|
else:
|
|
txt = ''
|
|
args = "bash dm.sh {} tgstation.dme".format(txt)
|
|
print(args)
|
|
p = subprocess.Popen(args, shell=True)
|
|
wait(p)
|
|
|
|
def stage3():
|
|
play("sound/misc/compiler-stage2.ogg")
|
|
logfile = open('server.log~','w')
|
|
p = subprocess.Popen(
|
|
"DreamDaemon tgstation.dmb 25001 -trusted",
|
|
shell=True, stdout=PIPE, stderr=STDOUT)
|
|
try:
|
|
while p.returncode is None:
|
|
stdout = p.stdout.readline()
|
|
t = "Initializations complete."
|
|
if t in stdout:
|
|
play("sound/misc/server-ready.ogg")
|
|
sys.stdout.write(stdout)
|
|
sys.stdout.flush()
|
|
logfile.write(stdout)
|
|
finally:
|
|
logfile.flush()
|
|
os.fsync(logfile.fileno())
|
|
logfile.close()
|
|
p.kill()
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-s','---stage',default=1,type=int)
|
|
parser.add_argument('--only',action='store_true')
|
|
parser.add_argument('-m','--map',type=str)
|
|
args = parser.parse_args()
|
|
stage = args.stage
|
|
assert stage in (1,2,3)
|
|
if stage == 1:
|
|
stage1()
|
|
if not args.only:
|
|
stage = 2
|
|
if stage == 2:
|
|
stage2(args.map)
|
|
if not args.only:
|
|
stage = 3
|
|
if stage == 3:
|
|
stage3()
|
|
|
|
if __name__=='__main__':
|
|
try:
|
|
main()
|
|
except KeyboardInterrupt:
|
|
pass
|