2011-10-28 18:35:58 +02:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
from configobj import ConfigObj
|
|
|
|
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
print "Please run this as root."
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
|
|
|
|
|
|
|
def remove_file(path):
|
|
|
|
try:
|
|
|
|
os.remove(path)
|
|
|
|
except Exception, e:
|
|
|
|
pass
|
|
|
|
|
|
|
|
# load config file
|
|
|
|
try:
|
|
|
|
config = ConfigObj(PATH_INI_FILE)
|
|
|
|
except Exception, e:
|
|
|
|
print 'Error loading config file: ', e
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
try:
|
|
|
|
#remove log rotate script
|
2011-11-01 20:21:09 +01:00
|
|
|
print " * Removing Pypo Log Rotate Script"
|
2011-10-28 18:35:58 +02:00
|
|
|
remove_file("/etc/logrotate.d/airtime-liquidsoap")
|
|
|
|
|
|
|
|
#remove init.d script
|
2011-11-01 20:21:09 +01:00
|
|
|
print " * Removing Pypo init.d Script"
|
2011-10-28 18:35:58 +02:00
|
|
|
remove_file("/etc/init.d/airtime-playout")
|
2012-08-20 22:54:01 +02:00
|
|
|
remove_file("/etc/init.d/airtime-liquidsoap")
|
2011-10-28 18:35:58 +02:00
|
|
|
|
|
|
|
#remove bin, cache, tmp and file dir
|
2011-11-02 03:43:12 +01:00
|
|
|
print " * Removing Pypo Program Directory"
|
2011-10-28 18:35:58 +02:00
|
|
|
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
|
|
|
shutil.rmtree(config['cache_dir'], ignore_errors=True)
|
|
|
|
shutil.rmtree(config['file_dir'], ignore_errors=True)
|
|
|
|
shutil.rmtree(config['tmp_dir'], ignore_errors=True)
|
|
|
|
|
|
|
|
#remove liquidsoap and pypo log dir
|
2011-11-01 20:21:09 +01:00
|
|
|
print " * Removing Pypo Log Directories"
|
2011-10-28 18:35:58 +02:00
|
|
|
shutil.rmtree(config['liquidsoap_log_dir'], ignore_errors=True)
|
|
|
|
shutil.rmtree(config['pypo_log_dir'], ignore_errors=True)
|
|
|
|
|
|
|
|
#remove monit files
|
2011-11-01 20:21:09 +01:00
|
|
|
print " * Removing Pypo Monit Files"
|
2011-10-28 18:35:58 +02:00
|
|
|
remove_file("/etc/monit/conf.d/monit-airtime-playout.cfg")
|
|
|
|
remove_file("/etc/monit/conf.d/monit-airtime-liquidsoap.cfg")
|
|
|
|
remove_file("/etc/monit/conf.d/monit-airtime-generic.cfg")
|
2012-02-14 15:37:20 +01:00
|
|
|
remove_file("/etc/monit/conf.d/monit-airtime-rabbitmq-server.cfg")
|
2011-10-28 18:35:58 +02:00
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
print e
|