-added pypo uninstall script.

-pypo-install script now gives OS a little time to create directories before attempting to work with them.
This commit is contained in:
mkonecny 2010-12-17 12:46:09 -05:00
parent b3a0104191
commit 0ef528941e
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
BASE_PATH = '/opt/pypo/'
def remove_path(path):
os.system("rm -rf " + path)
def remove_user(username):
os.system("killall -u " + 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)
#os.system("delgroup " + username)
try:
print "Removing log directories"
remove_path("/var/log/pypo")
print "Removing pypo files"
remove_path(BASE_PATH)
print "Removing daemontool script pypo-fetch"
os.system("svc -dx /etc/service/pypo-fetch")
remove_path("rm -rf /etc/service/pypo-fetch")
print "Removing daemontool script pypo-push"
os.system("svc -dx /etc/service/pypo-push")
remove_path("rm -rf /etc/service/pypo-push")
print "Removing daemontool script pypo-liquidsoap"
os.system("svc -dx /etc/service/pypo-liquidsoap")
remove_path("rm -rf /etc/service/pypo-liquidsoap")
remove_user("pypo")
except Exception, e:
print "exception:" + str(e)