2010-12-17 18:46:09 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2011-04-15 20:45:10 +02:00
|
|
|
from configobj import ConfigObj
|
2010-12-17 18:46:09 +01:00
|
|
|
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
print "Please run this as root."
|
|
|
|
sys.exit(1)
|
|
|
|
|
2011-04-15 20:45:10 +02:00
|
|
|
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
2010-12-17 18:46:09 +01:00
|
|
|
|
|
|
|
def remove_path(path):
|
2011-06-17 17:16:27 +02:00
|
|
|
os.system('rm -rf "%s"' % path)
|
2010-12-17 18:46:09 +01:00
|
|
|
|
2011-01-26 14:23:22 +01:00
|
|
|
def get_current_script_dir():
|
|
|
|
current_script_dir = os.path.realpath(__file__)
|
|
|
|
index = current_script_dir.rindex('/')
|
|
|
|
return current_script_dir[0:index]
|
2011-09-26 18:51:02 +02:00
|
|
|
|
|
|
|
def remove_monit_file():
|
|
|
|
os.system("rm -f /etc/monit/conf.d/monit-airtime-playout.cfg")
|
|
|
|
os.system("rm -f /etc/monit/conf.d/monit-airtime-liquidsoap.cfg")
|
2010-12-17 20:15:53 +01:00
|
|
|
|
2010-12-17 18:46:09 +01:00
|
|
|
try:
|
2011-04-15 20:45:10 +02:00
|
|
|
# load config file
|
|
|
|
try:
|
|
|
|
config = ConfigObj(PATH_INI_FILE)
|
|
|
|
except Exception, e:
|
|
|
|
print 'Error loading config file: ', e
|
2011-06-01 18:32:42 +02:00
|
|
|
sys.exit(1)
|
2011-04-15 20:45:10 +02:00
|
|
|
|
2011-06-01 00:55:22 +02:00
|
|
|
os.system("/etc/init.d/airtime-playout stop")
|
2011-06-01 18:32:42 +02:00
|
|
|
os.system("rm -f /etc/init.d/airtime-playout")
|
2011-06-20 23:24:12 +02:00
|
|
|
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1")
|
2011-09-23 18:23:33 +02:00
|
|
|
|
2011-09-26 18:51:02 +02:00
|
|
|
#remove logrotate script
|
2011-09-23 18:23:33 +02:00
|
|
|
os.system("rm -f /etc/logrotate.d/airtime-liquidsoap")
|
2011-09-26 18:51:02 +02:00
|
|
|
|
|
|
|
print "Removing monit file"
|
|
|
|
remove_monit_file()
|
2011-04-20 06:46:03 +02:00
|
|
|
|
2011-04-15 20:45:10 +02:00
|
|
|
print "Removing cache directories"
|
|
|
|
remove_path(config["cache_base_dir"])
|
2010-12-17 18:46:09 +01:00
|
|
|
|
2011-04-16 00:23:51 +02:00
|
|
|
print "Removing symlinks"
|
2011-06-01 00:55:22 +02:00
|
|
|
os.system("rm -f /usr/bin/airtime-playout")
|
2011-04-16 00:23:51 +02:00
|
|
|
|
2010-12-17 18:46:09 +01:00
|
|
|
print "Removing pypo files"
|
2011-04-15 20:45:10 +02:00
|
|
|
remove_path(config["bin_dir"])
|
2010-12-17 18:46:09 +01:00
|
|
|
|
2011-03-24 19:01:16 +01:00
|
|
|
print "Pypo uninstall complete."
|
2010-12-17 18:46:09 +01:00
|
|
|
except Exception, e:
|
2011-01-11 22:35:43 +01:00
|
|
|
print "exception:" + str(e)
|