Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
2830137d23
|
@ -43,7 +43,7 @@ def copy_dir(src_dir, dest_dir):
|
|||
if not (os.path.exists(dest_dir)):
|
||||
print "Copying directory "+src_dir+" to "+dest_dir
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
|
||||
try:
|
||||
# Create users
|
||||
create_user("pypo")
|
||||
|
@ -91,8 +91,7 @@ try:
|
|||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
||||
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
||||
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
|
||||
os.system("svc -t /etc/service/pypo-fetch")
|
||||
|
||||
|
||||
print "Installing daemontool script pypo-push"
|
||||
create_path("/etc/service/pypo-push")
|
||||
create_path("/etc/service/pypo-push/log")
|
||||
|
@ -100,10 +99,9 @@ try:
|
|||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
|
||||
os.system("chmod -R 755 /etc/service/pypo-push")
|
||||
os.system("chown -R pypo:pypo /etc/service/pypo-push")
|
||||
os.system("svc -t /etc/service/pypo-push")
|
||||
|
||||
print "Installing daemontool script pypo-liquidsoap"
|
||||
os.system("svc -dk /etc/service/pypo-liquidsoap")
|
||||
os.system("svc -dk /etc/service/pypo-liquidsoap > /dev/null 2>&1")
|
||||
os.system("killall liquidsoap")
|
||||
create_path("/etc/service/pypo-liquidsoap")
|
||||
create_path("/etc/service/pypo-liquidsoap/log")
|
||||
|
@ -111,7 +109,11 @@ try:
|
|||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
|
||||
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
||||
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
|
||||
os.system("svc -u /etc/service/pypo-liquidsoap")
|
||||
|
||||
print "Waiting for processes to start..."
|
||||
time.sleep(5)
|
||||
os.system("python ./pypo-start.py")
|
||||
time.sleep(2)
|
||||
|
||||
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||
output = p.stdout.read()
|
||||
|
@ -130,7 +132,7 @@ try:
|
|||
|
||||
#os.symlink(BASE_PATH+"bin/pypo-log.sh", "/usr/local/bin/")
|
||||
|
||||
|
||||
print "Install complete."
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print "Starting daemontool script pypo-fetch"
|
||||
os.system("svc -t /etc/service/pypo-fetch")
|
||||
|
||||
print "Starting daemontool script pypo-push"
|
||||
os.system("svc -t /etc/service/pypo-push")
|
||||
|
||||
print "Starting daemontool script pypo-liquidsoap"
|
||||
os.system("svc -t /etc/service/pypo-liquidsoap")
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print "Stopping daemontool script pypo-fetch"
|
||||
os.system("svc -dx /etc/service/pypo-fetch")
|
||||
|
||||
print "Stopping daemontool script pypo-push"
|
||||
os.system("svc -dx /etc/service/pypo-push")
|
||||
|
||||
print "Stopping daemontool script pypo-liquidsoap"
|
||||
os.system("svc -dx /etc/service/pypo-liquidsoap")
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
|
@ -0,0 +1,50 @@
|
|||
#!/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 + " > /dev/null")
|
||||
|
||||
#pypo group appears to be deleted when removing user.
|
||||
#os.system("delgroup " + username)
|
||||
|
||||
try:
|
||||
os.system("python ./pypo-stop.py")
|
||||
|
||||
print "Removing log directories"
|
||||
remove_path("/var/log/pypo")
|
||||
|
||||
print "Removing pypo files"
|
||||
remove_path(BASE_PATH)
|
||||
|
||||
print "Removing daemontool script pypo-fetch"
|
||||
remove_path("rm -rf /etc/service/pypo-fetch")
|
||||
|
||||
print "Removing daemontool script pypo-push"
|
||||
remove_path("rm -rf /etc/service/pypo-push")
|
||||
|
||||
print "Removing daemontool script pypo-liquidsoap"
|
||||
remove_path("rm -rf /etc/service/pypo-liquidsoap")
|
||||
|
||||
remove_user("pypo")
|
||||
print "Uninstall complete."
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
Loading…
Reference in New Issue