CC-2758: Make airtime-install script Debian/Ubuntu compatible
-cleanup
This commit is contained in:
parent
caf8ce9bbf
commit
38a0f8697a
|
@ -38,6 +38,7 @@ SCRIPT=`readlink -f $0`
|
|||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
AIRTIMEROOT=$SCRIPTPATH/../
|
||||
|
||||
rm -rf "/usr/lib/airtime"
|
||||
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
|
||||
python $AIRTIMEROOT/python_apps/create-pypo-user.py
|
||||
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +e
|
||||
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
|
||||
set -e
|
||||
if [[ "$DEB" = "Status: install ok installed" ]]; then
|
||||
echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
#Check whether version of virtualenv is <= 1.4.8. If so exit install.
|
||||
BAD_VERSION="1.4.8"
|
||||
VERSION=$(virtualenv --version)
|
||||
NEWEST_VERSION=$(echo -e "$BAD_VERSION\n$VERSION\n'" | sort -t '.' -g | tail -n 1)
|
||||
echo -n "Ensuring python-virtualenv version > $BAD_VERSION..."
|
||||
if [[ "$NEWEST_VERSION" = "$BAD_VERSION" ]]; then
|
||||
URL="http://apt.sourcefabric.org/pool/main/p/python-virtualenv/python-virtualenv_1.4.9-3_all.deb"
|
||||
echo "Failed!"
|
||||
echo "You have version $BAD_VERSION or older installed. Please install package at $URL first and then try installing Airtime again."
|
||||
exit 1
|
||||
else
|
||||
echo "Success!"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "\n******************************** Install Begin *********************************"
|
||||
|
||||
# Absolute path to this script
|
||||
SCRIPT=`readlink -f $0`
|
||||
# Absolute directory this script is in
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
${SCRIPTPATH}/../python_apps/python-virtualenv/virtualenv-install.sh
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
||||
echo -e "\n*** Creating Pypo User ***"
|
||||
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
||||
|
||||
set +e
|
||||
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-install.php $@
|
||||
result=$?
|
||||
|
||||
if [ "$result" -ne "0" ]; then
|
||||
#There was an error, exit with error code.
|
||||
echo "There was an error during upgrade. Exit code $result"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
||||
echo -e "\n*** API Client Installation ***"
|
||||
python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_install.py
|
||||
|
||||
echo -e "\n*** Pypo Installation ***"
|
||||
python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-install.py
|
||||
|
||||
echo -e "\n*** Recorder Installation ***"
|
||||
python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-install.py
|
||||
|
||||
echo -e "\n*** Media Monitor Installation ***"
|
||||
python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.py
|
||||
|
||||
python ${SCRIPTPATH}/../python_apps/icecast2/install/icecast2-install.py
|
||||
|
||||
# Start monit if it is not running, or restart if it is.
|
||||
# Need to ensure monit is running before Airtime daemons are run. This is
|
||||
# so we can ensure they can register with monit to monitor them when they start.
|
||||
# If monit is already running, this step is still useful as we need monit to
|
||||
# reload its config files.
|
||||
/etc/init.d/monit restart
|
||||
|
||||
#give monit some time to boot-up before issuing commands
|
||||
sleep 1
|
||||
|
||||
set +e
|
||||
monit monitor airtime-media-monitor
|
||||
monit monitor airtime-liquidsoap
|
||||
monit monitor airtime-playout
|
||||
monit monitor airtime-show-recorder
|
||||
monit monitor rabbitmq-server
|
||||
set -e
|
||||
|
||||
echo -e "\n*** Verifying your system environment ***"
|
||||
sleep 10
|
||||
airtime-check-system
|
||||
|
||||
echo -e "\n******************************* Install Complete *******************************"
|
|
@ -1,56 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
|
||||
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
||||
echo -e "\nAirtime is not installed, cannot uninstall.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
. ${virtualenv_bin}activate
|
||||
|
||||
#Cause bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
set -e
|
||||
|
||||
# Absolute path to this script
|
||||
SCRIPT=`readlink -f $0`
|
||||
# Absolute directory this script is in
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
echo -e "\n******************************* Uninstall Begin ********************************"
|
||||
|
||||
set +e
|
||||
monit unmonitor rabbitmq-server >/dev/null 2>&1
|
||||
set -e
|
||||
|
||||
$SCRIPTPATH/include/airtime-uninitialize.sh
|
||||
$SCRIPTPATH/include/airtime-remove-files.sh
|
||||
|
||||
#echo -e "\n*** Uninstalling Pypo ***"
|
||||
#python ${SCRIPTPATH}/../python_apps/pypo/install/pypo-uninstall.py
|
||||
|
||||
#echo -e "\n*** Uninstalling Show Recorder ***"
|
||||
#python ${SCRIPTPATH}/../python_apps/show-recorder/install/recorder-uninstall.py
|
||||
|
||||
#echo -e "\n*** Uninstalling Media Monitor ***"
|
||||
#python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-uninstall.py
|
||||
|
||||
#echo -e "\n*** Uninstalling API Client ***"
|
||||
#python ${SCRIPTPATH}/../python_apps/api_clients/install/api_client_uninstall.py
|
||||
|
||||
|
||||
echo -e "\n*** Removing Pypo User ***"
|
||||
python ${SCRIPTPATH}/../python_apps/remove-pypo-user.py
|
||||
|
||||
#php ${SCRIPTPATH}/include/airtime-uninstall.php
|
||||
|
||||
echo -e "\n****************************** Uninstall Complete ******************************\n"
|
||||
echo "NOTE: To fully remove all Airtime files, you will also have to manually delete"
|
||||
echo " the directories '/srv/airtime'(default storage location of media files)"
|
||||
echo -e " and '/etc/airtime'(where the config files are stored).\n"
|
|
@ -52,9 +52,9 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
|||
|
||||
echo "* Creating /usr/lib/airtime"
|
||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-install-files.py
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-install-files.py
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-install-files.py
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
|
||||
|
||||
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
||||
|
||||
|
@ -66,6 +66,7 @@ ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
|
|||
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
|
||||
|
||||
echo "* Creating /usr/share/airtime"
|
||||
rm -rf "/usr/share/airtime"
|
||||
mkdir -p /usr/share/airtime
|
||||
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
||||
SCRIPT=`readlink -f $0`
|
||||
# Absolute path this script is in, thus /home/user/bin
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
BIN_DIR=/usr/lib/airtime/api_clients
|
||||
|
||||
#copy api_client files
|
||||
cp -R $SCRIPTPATH/../../api_clients $BIN_DIR
|
|
@ -1,87 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import os
|
||||
import traceback
|
||||
from optparse import *
|
||||
import sys
|
||||
import time
|
||||
import datetime
|
||||
import logging
|
||||
import logging.config
|
||||
import shutil
|
||||
import string
|
||||
import platform
|
||||
from configobj import ConfigObj
|
||||
from subprocess import Popen
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
|
||||
|
||||
def create_path(path):
|
||||
if not (os.path.exists(path)):
|
||||
print "Creating directory " + path
|
||||
os.makedirs(path)
|
||||
|
||||
def copy_dir(src_dir, dest_dir):
|
||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
print "Removing old directory "+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)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def get_current_script_dir():
|
||||
current_script_dir = os.path.realpath(__file__)
|
||||
index = current_script_dir.rindex('/')
|
||||
return current_script_dir[0:index]
|
||||
|
||||
def copy_monit_file(current_script_dir):
|
||||
shutil.copy("%s/../monit-airtime-media-monitor.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
|
||||
|
||||
try:
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
current_script_dir = get_current_script_dir()
|
||||
|
||||
copy_monit_file(current_script_dir)
|
||||
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
print "Creating log directories"
|
||||
create_path(config["log_dir"])
|
||||
#os.system("chmod -R 755 " + config["log_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
||||
|
||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||
|
||||
print "Setting permissions"
|
||||
os.system("chmod -R 755 "+config["bin_dir"])
|
||||
#os.system("chmod -R 755 "+config["bin_dir"]+"/airtime-media-monitor)
|
||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||
|
||||
print "Installing media-monitor daemon"
|
||||
shutil.copy(config["bin_dir"]+"/airtime-media-monitor-init-d", "/etc/init.d/airtime-media-monitor")
|
||||
|
||||
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
print "Waiting for processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
sys.exit(1)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
python media-monitor-install-files.py
|
||||
python media-monitor-initialize.py
|
|
@ -1,163 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import os
|
||||
from optparse import *
|
||||
import sys
|
||||
import shutil
|
||||
import platform
|
||||
from configobj import ConfigObj
|
||||
from subprocess import Popen
|
||||
sys.path.append('/usr/lib/airtime/api_clients/')
|
||||
import api_client
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
||||
|
||||
def create_path(path):
|
||||
if not (os.path.exists(path)):
|
||||
print "Creating directory " + path
|
||||
os.makedirs(path)
|
||||
|
||||
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)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def get_current_script_dir():
|
||||
current_script_dir = os.path.realpath(__file__)
|
||||
index = current_script_dir.rindex('/')
|
||||
return current_script_dir[0:index]
|
||||
|
||||
def is_natty():
|
||||
try:
|
||||
f = open('/etc/lsb-release')
|
||||
except IOError as e:
|
||||
#File doesn't exist, so we're not even dealing with Ubuntu
|
||||
return False
|
||||
|
||||
for line in f:
|
||||
split = line.split("=")
|
||||
split[0] = split[0].strip(" \r\n")
|
||||
split[1] = split[1].strip(" \r\n")
|
||||
if split[0] == "DISTRIB_CODENAME" and (split[1] == "natty" or split[1] == "oneiric"):
|
||||
return True
|
||||
return False
|
||||
|
||||
def copy_monit_file(current_script_dir):
|
||||
shutil.copy("%s/../monit-airtime-playout.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
shutil.copy("%s/../monit-airtime-liquidsoap.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
|
||||
try:
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
current_script_dir = get_current_script_dir()
|
||||
|
||||
copy_monit_file(current_script_dir)
|
||||
|
||||
p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
create_path(config["pypo_log_dir"])
|
||||
os.system("chmod -R 755 " + config["pypo_log_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["pypo_log_dir"])
|
||||
|
||||
create_path(config["liquidsoap_log_dir"])
|
||||
os.system("chmod -R 755 " + config["liquidsoap_log_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["liquidsoap_log_dir"])
|
||||
|
||||
create_path(config["bin_dir"]+"/bin")
|
||||
create_path(config["cache_dir"])
|
||||
create_path(config["file_dir"])
|
||||
create_path(config["tmp_dir"])
|
||||
|
||||
architecture = platform.architecture()[0]
|
||||
natty = is_natty()
|
||||
|
||||
if architecture == '64bit' and 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)"
|
||||
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"
|
||||
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"
|
||||
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||
else:
|
||||
print "Unknown system architecture."
|
||||
sys.exit(1)
|
||||
|
||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"]+"/bin/")
|
||||
|
||||
# delete /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap.cfg
|
||||
# as we don't use it anymore.(CC-2552)
|
||||
os.remove(config["bin_dir"]+"/bin/liquidsoap_scripts/liquidsoap.cfg")
|
||||
|
||||
print "Setting permissions"
|
||||
os.system("chmod 755 "+os.path.join(config["bin_dir"], "liquidsoap_scripts/notify.sh"))
|
||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["cache_base_dir"])
|
||||
|
||||
print "Installing pypo daemon"
|
||||
shutil.copy(config["bin_dir"]+"/bin/airtime-playout-init-d", "/etc/init.d/airtime-playout")
|
||||
|
||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
#copy logrotate script
|
||||
shutil.copy(config["bin_dir"]+"/bin/liquidsoap_scripts/airtime-liquidsoap.logrotate", "/etc/logrotate.d/airtime-liquidsoap")
|
||||
|
||||
|
||||
# we should access the DB and generate liquidsoap.cfg under /etc/airtime/
|
||||
api_client = api_client.api_client_factory(config)
|
||||
ss = api_client.get_stream_setting()
|
||||
|
||||
# if api_client is somehow not working, just use original cfg file
|
||||
if(ss is not None):
|
||||
data = ss['msg']
|
||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
||||
fh.write("################################################\n")
|
||||
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
|
||||
fh.write("################################################\n")
|
||||
for d in data:
|
||||
buffer = d[u'keyname'] + " = "
|
||||
if(d[u'type'] == 'string'):
|
||||
temp = d[u'value']
|
||||
if(temp == ""):
|
||||
temp = ""
|
||||
buffer += "\"" + temp + "\""
|
||||
else:
|
||||
temp = d[u'value']
|
||||
if(temp == ""):
|
||||
temp = "0"
|
||||
buffer += temp
|
||||
buffer += "\n"
|
||||
fh.write(buffer)
|
||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||
fh.close()
|
||||
else:
|
||||
print "Unable to connect to the Airtime server."
|
||||
print "Waiting for processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
sys.exit(1)
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
python pypo-install-files.py
|
||||
python pypo-initialize.py
|
|
@ -32,7 +32,7 @@ try:
|
|||
remove_file("/etc/init.d/airtime-playout")
|
||||
|
||||
#remove bin, cache, tmp and file dir
|
||||
print " * Removing Pypo Program directories"
|
||||
print " * Removing Pypo Program Directory"
|
||||
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
||||
shutil.rmtree(config['cache_dir'], ignore_errors=True)
|
||||
shutil.rmtree(config['file_dir'], ignore_errors=True)
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import time
|
||||
import os
|
||||
from optparse import *
|
||||
import sys
|
||||
import shutil
|
||||
from configobj import ConfigObj
|
||||
from subprocess import Popen
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/recorder.cfg'
|
||||
|
||||
def create_path(path):
|
||||
if not (os.path.exists(path)):
|
||||
print "Creating directory " + path
|
||||
os.makedirs(path)
|
||||
|
||||
def copy_dir(src_dir, dest_dir):
|
||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||
print "Removing old directory "+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)
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
def get_current_script_dir():
|
||||
current_script_dir = os.path.realpath(__file__)
|
||||
index = current_script_dir.rindex('/')
|
||||
return current_script_dir[0:index]
|
||||
|
||||
def copy_monit_file(current_script_dir):
|
||||
shutil.copy("%s/../monit-airtime-show-recorder.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
|
||||
|
||||
|
||||
try:
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
current_script_dir = get_current_script_dir()
|
||||
|
||||
copy_monit_file(current_script_dir)
|
||||
|
||||
p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
print "Creating temporary media storage directory"
|
||||
create_path(config["base_recorded_files"])
|
||||
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
||||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
||||
|
||||
print "Creating log directories"
|
||||
create_path(config["log_dir"])
|
||||
os.system("chmod -R 755 " + config["log_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["log_dir"])
|
||||
|
||||
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||
|
||||
print "Setting permissions"
|
||||
os.system("chmod -R 755 "+config["bin_dir"])
|
||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||
|
||||
print "Installing show-recorder daemon"
|
||||
shutil.copy(config["bin_dir"]+"/airtime-show-recorder-init-d", "/etc/init.d/airtime-show-recorder")
|
||||
|
||||
p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
print "Waiting for processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
sys.exit(1)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
python recorder-install-files.py
|
||||
python recorder-initialize.py
|
|
@ -24,11 +24,11 @@ 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 Directory"
|
||||
shutil.rmtree(config["bin_dir"], ignore_errors=True)
|
||||
|
||||
#remove log dir
|
||||
|
|
Loading…
Reference in New Issue