sintonia/python_apps/show-recorder/install/recorder-uninstall.py
Paul Baranowski 173d82007f CC-2166 Packaging improvements
Added command line options to the install process to overwrite or
preserve the existing config files.

Added the pypo-start/stop and recorder-start/stop symlinks to /usr/bin.

Renamed pypo-start.py to airtime-pypo-start.
Renamed pypo-stop.py to airtime-pypo-stop.
Renamed recorder-start.py to airtime-show-recorder-start.
Renamed recorder-stop.py to airtime-show-recorder-stop.

Renamed testrecordscript.py to recorder.py
2011-04-15 18:23:51 -04:00

61 lines
1.6 KiB
Python
Executable file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
from configobj import ConfigObj
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
PATH_INI_FILE = '/etc/airtime/recorder.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('/')
return current_script_dir[0:index]
try:
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit()
os.system("python /usr/bin/airtime-show-recorder-stop")
print "Removing log directories"
remove_path(config["log_dir"])
print "Removing symlinks"
os.system("rm -f /usr/bin/airtime-show-recorder-start")
os.system("rm -f /usr/bin/airtime-show-recorder-stop")
print "Removing application files"
remove_path(config["bin_dir"])
print "Removing media files"
remove_path(config["base_recorded_files"])
print "Removing daemontool script recorder"
remove_path("rm -rf /etc/service/recorder")
remove_user("pypo")
print "Uninstall complete."
except Exception, e:
print "exception:" + str(e)