cc-2055: switch to init.d

-allow install script to be created from any location (no hardcoded paths)
-make python install scripts return 1 on error
-daemon now started automatically on boot using rc.local autostart
-change all prints to logs instead
-create airtime-uninstall shell script (and remove pypo user in here)
-create pypo user in shell script
This commit is contained in:
martin 2011-06-01 12:32:42 -04:00
parent 079d9d36b0
commit 6ab5ac4582
23 changed files with 179 additions and 224 deletions

View file

@ -15,15 +15,6 @@ PATH_INI_FILE = '/etc/airtime/pypo.cfg'
def remove_path(path):
os.system("rm -rf " + path)
def remove_user(username):
os.system("killall -u %s 1>/dev/null 2>&1" % username)
#allow all process to be completely closed before we attempt to delete user
print "Waiting for processes to close..."
time.sleep(5)
os.system("deluser --remove-home " + username + " 1>/dev/null 2>&1")
def get_current_script_dir():
current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/')
@ -35,9 +26,10 @@ try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit()
sys.exit(1)
os.system("/etc/init.d/airtime-playout stop")
os.system("rm -f /etc/init.d/airtime-playout")
print "Removing cache directories"
remove_path(config["cache_base_dir"])
@ -48,7 +40,6 @@ try:
print "Removing pypo files"
remove_path(config["bin_dir"])
remove_user("pypo")
print "Pypo uninstall complete."
except Exception, e:
print "exception:" + str(e)