CC-2758: Make airtime-install script Debian/Ubuntu compatible
-cosmetic changes
This commit is contained in:
parent
d2f4e55dd6
commit
f2ef006385
17 changed files with 67 additions and 51 deletions
|
@ -10,7 +10,7 @@ def copy_dir(src_dir, dest_dir):
|
|||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
shutil.rmtree(dest_dir)
|
||||
if not (os.path.exists(dest_dir)):
|
||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
current_script_dir = get_current_script_dir()
|
||||
|
|
|
@ -17,5 +17,5 @@ except Exception, e:
|
|||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
print "Removing API Client files"
|
||||
print " * Removing API Client files"
|
||||
remove_path(config["bin_dir"])
|
||||
|
|
|
@ -3,14 +3,14 @@ import sys
|
|||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
def create_user(username):
|
||||
print "Checking for user "+username
|
||||
print "* Checking for user "+username
|
||||
|
||||
p = Popen('id '+username, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||
output = p.stdout.read()
|
||||
|
||||
if (output[0:3] != "uid"):
|
||||
# Make the pypo user
|
||||
print "Creating user "+username
|
||||
print " * Creating user "+username
|
||||
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
||||
|
||||
#set pypo password
|
||||
|
|
|
@ -11,7 +11,7 @@ try:
|
|||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#Start media-monitor daemon
|
||||
print "Waiting for media-monitor processes to start..."
|
||||
print "* Waiting for media-monitor processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
|||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
shutil.rmtree(dest_dir)
|
||||
if not (os.path.exists(dest_dir)):
|
||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def create_dir(path):
|
||||
|
|
|
@ -24,19 +24,19 @@ except Exception, e:
|
|||
|
||||
try:
|
||||
#remove init.d script
|
||||
print "* Removing Media-Monitor init.d Script"
|
||||
print " * Removing Media-Monitor init.d Script"
|
||||
remove_file("/etc/init.d/airtime-media-monitor")
|
||||
|
||||
#remove bin dir
|
||||
print "* Removing Media-Monitor Program Directory"
|
||||
print " * Removing Media-Monitor Program Directory"
|
||||
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
||||
|
||||
#remove log dir
|
||||
print "* Removing Media-Monitor Log Directory"
|
||||
print " * Removing Media-Monitor Log Directory"
|
||||
shutil.rmtree(config['log_dir'], ignore_errors=True)
|
||||
|
||||
#remove monit files
|
||||
print "* Removing Media-Monitor Monit Files"
|
||||
print " * Removing Media-Monitor Monit Files"
|
||||
remove_file("/etc/monit/conf.d/monit-airtime-media-monitor.cfg")
|
||||
remove_file("/etc/monit/conf.d/monit-airtime-generic.cfg")
|
||||
|
||||
|
|
|
@ -70,17 +70,19 @@ try:
|
|||
architecture = platform.architecture()[0]
|
||||
natty = is_natty()
|
||||
|
||||
print "* Detecting system architecture for Liquidsoap"
|
||||
|
||||
if architecture == '64bit' and natty:
|
||||
print "Installing 64-bit liquidsoap binary (Natty)"
|
||||
print " * Installing 64-bit liquidsoap binary (Natty)"
|
||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||
elif architecture == '32bit' and natty:
|
||||
print "Installing 32-bit liquidsoap binary (Natty)"
|
||||
print " * Installing 32-bit liquidsoap binary (Natty)"
|
||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||
elif architecture == '64bit' and not natty:
|
||||
print "Installing 64-bit liquidsoap binary"
|
||||
print " * Installing 64-bit liquidsoap binary"
|
||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||
elif architecture == '32bit' and not natty:
|
||||
print "Installing 32-bit liquidsoap binary"
|
||||
print " * Installing 32-bit liquidsoap binary"
|
||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||
else:
|
||||
print "Unknown system architecture."
|
||||
|
@ -101,7 +103,7 @@ try:
|
|||
print "Unable to connect to the Airtime server."
|
||||
|
||||
#restart airtime-playout
|
||||
print "Waiting for pypo processes to start..."
|
||||
print "* Waiting for pypo processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
|||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
shutil.rmtree(dest_dir)
|
||||
if not (os.path.exists(dest_dir)):
|
||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def create_dir(path):
|
||||
|
|
|
@ -24,27 +24,27 @@ except Exception, e:
|
|||
|
||||
try:
|
||||
#remove log rotate script
|
||||
print "* Removing Pypo Log Rotate Script"
|
||||
print " * Removing Pypo Log Rotate Script"
|
||||
remove_file("/etc/logrotate.d/airtime-liquidsoap")
|
||||
|
||||
#remove init.d script
|
||||
print "* Removing Pypo init.d Script"
|
||||
print " * Removing Pypo init.d Script"
|
||||
remove_file("/etc/init.d/airtime-playout")
|
||||
|
||||
#remove bin, cache, tmp and file dir
|
||||
print "* Removing Pypo Program directories"
|
||||
print " * Removing Pypo Program directories"
|
||||
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
|
||||
print "* Removing Pypo Log Directories"
|
||||
print " * Removing Pypo Log Directories"
|
||||
shutil.rmtree(config['liquidsoap_log_dir'], ignore_errors=True)
|
||||
shutil.rmtree(config['pypo_log_dir'], ignore_errors=True)
|
||||
|
||||
#remove monit files
|
||||
print "* Removing Pypo Monit Files"
|
||||
print " * Removing Pypo Monit Files"
|
||||
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")
|
||||
|
|
|
@ -12,7 +12,7 @@ try:
|
|||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#start daemon
|
||||
print "Waiting for show-recorder processes to start..."
|
||||
print "* Waiting for show-recorder processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||
|
|
|
@ -16,7 +16,7 @@ def copy_dir(src_dir, dest_dir):
|
|||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
shutil.rmtree(dest_dir)
|
||||
if not (os.path.exists(dest_dir)):
|
||||
print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
#print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def create_dir(path):
|
||||
|
@ -43,13 +43,13 @@ try:
|
|||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create temporary media-storage directory
|
||||
print "Creating temporary media storage directory"
|
||||
#print "Creating temporary media storage directory"
|
||||
create_dir(config["base_recorded_files"])
|
||||
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
||||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
||||
|
||||
#create log directories
|
||||
print "Creating log directories"
|
||||
#print "Creating log directories"
|
||||
create_dir(config["log_dir"])
|
||||
os.system("chmod -R 755 " + config["log_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
||||
|
@ -58,7 +58,7 @@ try:
|
|||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||
|
||||
#set python file permissions
|
||||
print "Setting permissions"
|
||||
#print "Setting permissions"
|
||||
os.system("chmod -R 755 "+config["bin_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||
|
||||
|
|
|
@ -24,23 +24,23 @@ except Exception, e:
|
|||
|
||||
try:
|
||||
#remove init.d script
|
||||
print "* Removing Show-Recorder init.d script"
|
||||
print " * Removing Show-Recorder init.d script"
|
||||
remove_file('/etc/init.d/airtime-show-recorder')
|
||||
|
||||
#remove bin dir
|
||||
print "* Removing Show-Recorder Program Directories"
|
||||
print " * Removing Show-Recorder Program Directories"
|
||||
shutil.rmtree(config["bin_dir"], ignore_errors=True)
|
||||
|
||||
#remove log dir
|
||||
print "* Removing Show-Recorder Log Directory"
|
||||
print " * Removing Show-Recorder Log Directory"
|
||||
shutil.rmtree(config["log_dir"], ignore_errors=True)
|
||||
|
||||
#remove temporary media-storage dir
|
||||
print "* Removing Show-Recorder Temporary Directory"
|
||||
print " * Removing Show-Recorder Temporary Directory"
|
||||
shutil.rmtree(config["base_recorded_files"], ignore_errors=True)
|
||||
|
||||
#remove monit files
|
||||
print "* Removing Show-Recorder Monit Files"
|
||||
print " * Removing Show-Recorder Monit Files"
|
||||
remove_file("/etc/monit/conf.d/monit-airtime-show-recorder.cfg")
|
||||
remove_file("/etc/monit/conf.d/monit-airtime-generic.cfg")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue