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
|
@ -44,6 +44,10 @@ python $AIRTIMEROOT/python_apps/create-pypo-user.py
|
||||||
$SCRIPTPATH/include/airtime-copy-files.sh
|
$SCRIPTPATH/include/airtime-copy-files.sh
|
||||||
$SCRIPTPATH/include/airtime-initialize.sh $@
|
$SCRIPTPATH/include/airtime-initialize.sh $@
|
||||||
|
|
||||||
|
#Hack to parse rabbitmq pid and place it into the correct directory. This is also
|
||||||
|
#done in our rabbitmq init.d script, but placing it here so that monit recognizes
|
||||||
|
# it faster (in time for the airtime-check-system)
|
||||||
|
sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid
|
||||||
|
|
||||||
echo -e "\n*** Verifying your system environment, running airtime-check-system ***"
|
echo -e "\n*** Verifying your system environment, running airtime-check-system ***"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
|
@ -6,6 +6,8 @@ if [ `whoami` != 'root' ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -e "\n******************************* Uninstall Begin ********************************"
|
||||||
|
|
||||||
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
||||||
SCRIPT=`readlink -f $0`
|
SCRIPT=`readlink -f $0`
|
||||||
# Absolute path this script is in, thus /home/user/bin
|
# Absolute path this script is in, thus /home/user/bin
|
||||||
|
@ -19,3 +21,5 @@ $SCRIPTPATH/include/airtime-remove-files.sh
|
||||||
|
|
||||||
#Remove pypo user
|
#Remove pypo user
|
||||||
python $SCRIPTPATH/../python_apps/remove-pypo-user.py
|
python $SCRIPTPATH/../python_apps/remove-pypo-user.py
|
||||||
|
|
||||||
|
echo -e "\n****************************** Uninstall Complete *******************************"
|
||||||
|
|
|
@ -43,7 +43,7 @@ class AirtimeInstall
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "New Airtime Install.".PHP_EOL;
|
//echo "New Airtime Install.".PHP_EOL;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class AirtimeInstall
|
||||||
|
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||||
if (PEAR::isError($CC_DBC)) {
|
if (PEAR::isError($CC_DBC)) {
|
||||||
echo "New Airtime Install.".PHP_EOL;
|
//echo "New Airtime Install.".PHP_EOL;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -431,8 +431,6 @@ class AirtimeInstall
|
||||||
public static function CreateZendPhpLogFile(){
|
public static function CreateZendPhpLogFile(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
echo "* Creating logs directory ".AirtimeInstall::CONF_DIR_LOG.PHP_EOL;
|
|
||||||
|
|
||||||
$path = AirtimeInstall::CONF_DIR_LOG;
|
$path = AirtimeInstall::CONF_DIR_LOG;
|
||||||
$file = $path.'/zendphp.log';
|
$file = $path.'/zendphp.log';
|
||||||
if (!file_exists($path)){
|
if (!file_exists($path)){
|
||||||
|
|
|
@ -33,6 +33,7 @@ SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
|
||||||
AIRTIMEROOT=$SCRIPTPATH/../../
|
AIRTIMEROOT=$SCRIPTPATH/../../
|
||||||
|
|
||||||
|
echo "* Creating /etc/airtime"
|
||||||
mkdir -p /etc/airtime
|
mkdir -p /etc/airtime
|
||||||
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
|
cp $AIRTIMEROOT/airtime_mvc/build/airtime.conf /etc/airtime
|
||||||
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime
|
cp $AIRTIMEROOT/python_apps/api_clients/api_client.cfg /etc/airtime
|
||||||
|
@ -41,6 +42,7 @@ cp $AIRTIMEROOT/python_apps/media-monitor/media-monitor.cfg /etc/airtime
|
||||||
cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime
|
cp $AIRTIMEROOT/python_apps/pypo/pypo.cfg /etc/airtime
|
||||||
cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
|
cp $AIRTIMEROOT/python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
|
||||||
|
|
||||||
|
echo "* Creating /etc/cron.d/airtime-crons"
|
||||||
HOUR=$(($RANDOM%24))
|
HOUR=$(($RANDOM%24))
|
||||||
MIN=$(($RANDOM%60))
|
MIN=$(($RANDOM%60))
|
||||||
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
||||||
|
@ -48,6 +50,7 @@ echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
echo "* Creating /usr/lib/airtime"
|
||||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
|
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/pypo/install/pypo-install-files.py
|
||||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-install-files.py
|
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-install-files.py
|
||||||
|
@ -55,16 +58,21 @@ python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-install-files.py
|
||||||
|
|
||||||
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
||||||
|
|
||||||
|
echo "* Creating symbolic links in /usr/bin"
|
||||||
#create symbolic links
|
#create symbolic links
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
|
ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
|
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
|
||||||
ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
|
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
|
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
|
||||||
|
|
||||||
|
echo "* Creating /usr/share/airtime"
|
||||||
mkdir -p /usr/share/airtime
|
mkdir -p /usr/share/airtime
|
||||||
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
||||||
|
|
||||||
|
echo "* Creating /var/log/airtime"
|
||||||
mkdir -p /var/log/airtime
|
mkdir -p /var/log/airtime
|
||||||
|
|
||||||
|
echo "* Creating /var/tmp/airtime"
|
||||||
mkdir -p /var/tmp/airtime
|
mkdir -p /var/tmp/airtime
|
||||||
|
|
||||||
#Finished copying files
|
#Finished copying files
|
||||||
|
|
|
@ -13,7 +13,7 @@ require_once(__DIR__.'/airtime-constants.php');
|
||||||
|
|
||||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||||
|
|
||||||
echo PHP_EOL."*** Database Installation ***".PHP_EOL;
|
echo PHP_EOL."* Database Installation".PHP_EOL;
|
||||||
|
|
||||||
AirtimeInstall::CreateDatabaseUser();
|
AirtimeInstall::CreateDatabaseUser();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ def copy_dir(src_dir, dest_dir):
|
||||||
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(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)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
current_script_dir = get_current_script_dir()
|
current_script_dir = get_current_script_dir()
|
||||||
|
|
|
@ -17,5 +17,5 @@ except Exception, e:
|
||||||
print 'Error loading config file: ', e
|
print 'Error loading config file: ', e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print "Removing API Client files"
|
print " * Removing API Client files"
|
||||||
remove_path(config["bin_dir"])
|
remove_path(config["bin_dir"])
|
||||||
|
|
|
@ -3,14 +3,14 @@ import sys
|
||||||
from subprocess import Popen, PIPE, STDOUT
|
from subprocess import Popen, PIPE, STDOUT
|
||||||
|
|
||||||
def create_user(username):
|
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)
|
p = Popen('id '+username, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||||
output = p.stdout.read()
|
output = p.stdout.read()
|
||||||
|
|
||||||
if (output[0:3] != "uid"):
|
if (output[0:3] != "uid"):
|
||||||
# Make the pypo user
|
# Make the pypo user
|
||||||
print "Creating user "+username
|
print " * Creating user "+username
|
||||||
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
||||||
|
|
||||||
#set pypo password
|
#set pypo password
|
||||||
|
|
|
@ -11,7 +11,7 @@ try:
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
#Start media-monitor daemon
|
#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)
|
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
|
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 != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(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)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
||||||
|
|
|
@ -70,17 +70,19 @@ try:
|
||||||
architecture = platform.architecture()[0]
|
architecture = platform.architecture()[0]
|
||||||
natty = is_natty()
|
natty = is_natty()
|
||||||
|
|
||||||
|
print "* Detecting system architecture for Liquidsoap"
|
||||||
|
|
||||||
if architecture == '64bit' and natty:
|
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)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '32bit' and natty:
|
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)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-natty-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '64bit' and not natty:
|
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)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-amd64"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
elif architecture == '32bit' and not natty:
|
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)
|
shutil.copy("%s/../liquidsoap_bin/liquidsoap-i386"%current_script_dir, "%s/../liquidsoap_bin/liquidsoap"%current_script_dir)
|
||||||
else:
|
else:
|
||||||
print "Unknown system architecture."
|
print "Unknown system architecture."
|
||||||
|
@ -101,7 +103,7 @@ try:
|
||||||
print "Unable to connect to the Airtime server."
|
print "Unable to connect to the Airtime server."
|
||||||
|
|
||||||
#restart airtime-playout
|
#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)
|
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
|
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 != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(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)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
||||||
|
|
|
@ -12,7 +12,7 @@ try:
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
#start daemon
|
#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)
|
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)[1]
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
|
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 != "/"):
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
shutil.rmtree(dest_dir)
|
shutil.rmtree(dest_dir)
|
||||||
if not (os.path.exists(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)
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
def create_dir(path):
|
def create_dir(path):
|
||||||
|
@ -43,13 +43,13 @@ try:
|
||||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||||
|
|
||||||
#create temporary media-storage directory
|
#create temporary media-storage directory
|
||||||
print "Creating temporary media storage directory"
|
#print "Creating temporary media storage directory"
|
||||||
create_dir(config["base_recorded_files"])
|
create_dir(config["base_recorded_files"])
|
||||||
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
#os.system("chmod -R 755 "+config["base_recorded_files"])
|
||||||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
||||||
|
|
||||||
#create log directories
|
#create log directories
|
||||||
print "Creating log directories"
|
#print "Creating log directories"
|
||||||
create_dir(config["log_dir"])
|
create_dir(config["log_dir"])
|
||||||
os.system("chmod -R 755 " + config["log_dir"])
|
os.system("chmod -R 755 " + config["log_dir"])
|
||||||
os.system("chown -R pypo:pypo "+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"])
|
copy_dir("%s/.."%current_script_dir, config["bin_dir"])
|
||||||
|
|
||||||
#set python file permissions
|
#set python file permissions
|
||||||
print "Setting permissions"
|
#print "Setting permissions"
|
||||||
os.system("chmod -R 755 "+config["bin_dir"])
|
os.system("chmod -R 755 "+config["bin_dir"])
|
||||||
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
os.system("chown -R pypo:pypo "+config["bin_dir"])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue