more fixes for first run

This commit is contained in:
neersighted 2012-02-29 19:38:49 -08:00
parent 30fc42cd37
commit 739072bd39

View file

@ -5,10 +5,15 @@ import os
import subprocess import subprocess
import re import re
import json import json
try:
config = json.load(open('config')) if os.path.isfile("./config"):
except ValueError, e: command = command
print 'error: malformed config', e try:
config = json.load(open('config'))
except ValueError, e:
print 'error: malformed config', e
else:
config = False
nocol = "\033[1;m" nocol = "\033[1;m"
red = "\033[1;31m" red = "\033[1;31m"
@ -26,7 +31,10 @@ daemoncheck = subprocess.check_output("locate /usr/bin/daemon", shell=True)
daemon = re.match(r'^/usr/bin/daemon$', daemoncheck) daemon = re.match(r'^/usr/bin/daemon$', daemoncheck)
screencheck = subprocess.check_output("locate /usr/bin/screen", shell=True) screencheck = subprocess.check_output("locate /usr/bin/screen", shell=True)
screen = re.match(r'^/usr/bin/screen$', screencheck) screen = re.match(r'^/usr/bin/screen$', screencheck)
backend = config.get("wrapper", {}).get("backend", "daemon") if os.path.isfile("./config"):
backend = config.get("wrapper", {}).get("backend", "daemon")
else
backend = daemon
try: try:
runningcheck = subprocess.check_output("ps ax|grep cloudbot|"\ runningcheck = subprocess.check_output("ps ax|grep cloudbot|"\
@ -175,8 +183,6 @@ except (KeyboardInterrupt), e:
except (NameError, SyntaxError), e: except (NameError, SyntaxError), e:
print error6 print error6
exit exit
except (IOError), e:
pass
if os.path.isfile("./bot.py"): if os.path.isfile("./bot.py"):
command = command command = command
else: else: