CC-2758: Make airtime-install script Debian/Ubuntu compatible
-uninstall script added
This commit is contained in:
parent
153e0df409
commit
56edfe4e68
|
@ -84,7 +84,6 @@ class ApiController extends Zend_Controller_Action
|
|||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -752,7 +751,6 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->libraryInit = array(
|
||||
"numEntries"=>Application_Model_Preference::GetLibraryNumEntries()
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,53 +1,21 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -e
|
||||
|
||||
#Check if root user
|
||||
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
|
||||
# Absolute path to this script, e.g. /home/user/bin/foo.sh
|
||||
SCRIPT=`readlink -f $0`
|
||||
# Absolute directory this script is in
|
||||
# Absolute path this script is in, thus /home/user/bin
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
echo -e "\n******************************* Uninstall Begin ********************************"
|
||||
#Uninitialize Airtime
|
||||
$SCRIPTPATH/include/airtime-uninitialize.sh
|
||||
|
||||
set +e
|
||||
monit unmonitor rabbitmq-server >/dev/null 2>&1
|
||||
set -e
|
||||
#Remove Airtime files
|
||||
$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"
|
||||
#Remove pypo user
|
||||
python $SCRIPTPATH/../python_apps/remove-pypo-user.py
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#!/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"
|
|
@ -45,16 +45,16 @@ HOUR=$(($RANDOM%24))
|
|||
MIN=$(($RANDOM%60))
|
||||
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
||||
|
||||
cp $AIRTIMEROOT/python_apps/show-recorder/airtime-show-recorder-init-d /etc/init.d/airtime-show-recorder
|
||||
cp $AIRTIMEROOT/python_apps/media-monitor/airtime-media-monitor-init-d /etc/init.d/airtime-media-monitor
|
||||
cp $AIRTIMEROOT/python_apps/pypo/airtime-playout-init-d /etc/init.d/airtime-playout
|
||||
#cp $AIRTIMEROOT/python_apps/show-recorder/airtime-show-recorder-init-d /etc/init.d/airtime-show-recorder
|
||||
#cp $AIRTIMEROOT/python_apps/media-monitor/airtime-media-monitor-init-d /etc/init.d/airtime-media-monitor
|
||||
#cp $AIRTIMEROOT/python_apps/pypo/airtime-playout-init-d /etc/init.d/airtime-playout
|
||||
|
||||
cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/monit/monit-airtime-rabbitmq-server.cfg /etc/monit/conf.d/
|
||||
cp $AIRTIMEROOT/python_apps/media-monitor/monit-airtime-media-monitor.cfg /etc/monit/conf.d/
|
||||
cp $AIRTIMEROOT/python_apps/show-recorder/monit-airtime-show-recorder.cfg /etc/monit/conf.d/
|
||||
cp $AIRTIMEROOT/python_apps/pypo/monit-airtime-liquidsoap.cfg /etc/monit/conf.d/
|
||||
cp $AIRTIMEROOT/python_apps/pypo/monit-airtime-playout.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/media-monitor/monit-airtime-media-monitor.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/show-recorder/monit-airtime-show-recorder.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/pypo/monit-airtime-liquidsoap.cfg /etc/monit/conf.d/
|
||||
#cp $AIRTIMEROOT/python_apps/pypo/monit-airtime-playout.cfg /etc/monit/conf.d/
|
||||
|
||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-install-files.py
|
||||
|
|
|
@ -24,7 +24,7 @@ result=$?
|
|||
|
||||
if [ "$result" -ne "0" ]; then
|
||||
#There was an error, exit with error code.
|
||||
echo "There was an error during upgrade. Exit code $result"
|
||||
echo "There was an error during install. Exit code $result"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
@ -54,4 +54,3 @@ set -e
|
|||
echo -e "\n*** Verifying your system environment ***"
|
||||
sleep 10
|
||||
airtime-check-system
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#!/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
|
||||
|
||||
########################################################################
|
||||
# Complete list of files that we need to remove is available in
|
||||
# airtime-copy-files.sh
|
||||
#######################################################################
|
||||
|
||||
|
||||
# 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`
|
||||
|
||||
AIRTIMEROOT=$SCRIPTPATH/../../
|
||||
|
||||
#rm -f /etc/airtime/airtime.conf
|
||||
#rm -f /etc/airtime/api_client.cfg
|
||||
#rm -f /etc/airtime/recorder.cfg
|
||||
#rm -f /etc/airtime/media-monitor.cfg
|
||||
#rm -f /etc/airtime/pypo.cfg
|
||||
#rm -f /etc/airtime/liquidsoap.cfg
|
||||
|
||||
rm -f /etc/cron.d/airtime-crons
|
||||
|
||||
echo "API Client"
|
||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_uninstall.py
|
||||
echo "Pypo"
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-remove-files.py
|
||||
echo "Media-Monitor"
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-remove-files.py
|
||||
echo "Show-Recorder"
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-remove-files.py
|
||||
|
||||
rm -rf /usr/lib/airtime
|
||||
|
||||
#remove symlinks
|
||||
rm -f /usr/bin/airtime-import
|
||||
rm -f /usr/bin/airtime-update-db-settings
|
||||
rm -f /usr/bin/airtime-check-system
|
||||
rm -f /usr/bin/airtime-log
|
||||
|
||||
rm -rf /usr/share/airtime
|
||||
|
||||
rm -rf /var/log/airtime
|
||||
rm -rf /var/tmp/airtime
|
|
@ -0,0 +1,32 @@
|
|||
#!/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`
|
||||
AIRTIMEROOT=$SCRIPTPATH/../../
|
||||
|
||||
#unmonitor services
|
||||
echo "Unmonitoring Airtime Services"
|
||||
set +e
|
||||
monit unmonitor airtime-media-monitor
|
||||
monit unmonitor airtime-liquidsoap
|
||||
monit unmonitor airtime-playout
|
||||
monit unmonitor airtime-show-recorder
|
||||
#monit unmonitor rabbitmq-server
|
||||
set -e
|
||||
|
||||
#uninitialize Airtime services
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-uninitialize.py
|
||||
|
||||
#call Airtime uninstall script
|
||||
php --php-ini ${SCRIPTPATH}/../airtime-php.ini ${SCRIPTPATH}/airtime-uninstall.php
|
|
@ -20,7 +20,7 @@ require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php')
|
|||
|
||||
echo PHP_EOL;
|
||||
echo "* Uninstalling Airtime ".AIRTIME_VERSION.PHP_EOL;
|
||||
AirtimeInstall::UninstallPhpCode();
|
||||
//AirtimeInstall::UninstallPhpCode();
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Delete the database
|
||||
|
@ -77,12 +77,11 @@ if ($results == 0) {
|
|||
echo " * Nothing to delete.".PHP_EOL;
|
||||
}
|
||||
|
||||
AirtimeInstall::RemoveSymlinks();
|
||||
AirtimeInstall::UninstallBinaries();
|
||||
AirtimeInstall::RemoveLogDirectories();
|
||||
AirtimeInstall::removeVirtualEnvDistributeFile();
|
||||
AirtimeIni::RemoveMonitFile();
|
||||
|
||||
@unlink('/etc/cron.d/airtime-crons');
|
||||
//AirtimeInstall::RemoveSymlinks();
|
||||
//AirtimeInstall::UninstallBinaries();
|
||||
//AirtimeInstall::RemoveLogDirectories();
|
||||
//AirtimeInstall::removeVirtualEnvDistributeFile();
|
||||
//AirtimeIni::RemoveMonitFile();
|
||||
//@unlink('/etc/cron.d/airtime-crons');
|
||||
|
||||
/* FINISHED AIRTIME PHP UNINSTALLER */
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from configobj import ConfigObj
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
def remove_file(path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/media-monitor.cfg'
|
||||
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#remove 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"
|
||||
shutil.rmtree(config['bin_dir'], ignore_errors=True)
|
||||
|
||||
#remove log dir
|
||||
print "* Removing Media-Monitor Log Directory"
|
||||
shutil.rmtree(config['log_dir'], ignore_errors=True)
|
||||
|
||||
#remove 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")
|
||||
|
||||
except Exception, e:
|
||||
print e
|
|
@ -0,0 +1,14 @@
|
|||
from subprocess import Popen
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print "Waiting for media-monitor processes to stop..."
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
except Exception, e:
|
||||
print e
|
|
@ -0,0 +1,53 @@
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from configobj import ConfigObj
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
||||
|
||||
def remove_file(path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#remove 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"
|
||||
remove_file("/etc/init.d/airtime-playout")
|
||||
|
||||
#remove bin, cache, tmp and file dir
|
||||
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"
|
||||
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"
|
||||
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")
|
||||
|
||||
except Exception, e:
|
||||
print e
|
|
@ -0,0 +1,15 @@
|
|||
from subprocess import Popen
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#stop pypo and liquidsoap processes
|
||||
print "Waiting for pypo processes to stop..."
|
||||
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
except Exception, e:
|
||||
print e
|
|
@ -37,6 +37,10 @@ except Exception, e:
|
|||
try:
|
||||
# Absolute path this script is in
|
||||
current_script_dir = get_current_script_dir()
|
||||
|
||||
#copy monit files
|
||||
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/')
|
||||
|
||||
#create temporary media-storage directory
|
||||
print "Creating temporary media storage directory"
|
||||
|
@ -63,5 +67,3 @@ try:
|
|||
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from configobj import ConfigObj
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
def remove_file(path):
|
||||
try:
|
||||
os.remove(path)
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/recorder.cfg'
|
||||
|
||||
# load config file
|
||||
try:
|
||||
config = ConfigObj(PATH_INI_FILE)
|
||||
except Exception, e:
|
||||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
#remove 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"
|
||||
shutil.rmtree(config["bin_dir"])
|
||||
|
||||
#remove log dir
|
||||
print "* Removing Show-Recorder Log Directory"
|
||||
shutil.rmtree(config["log_dir"])
|
||||
|
||||
#remove temporary media-storage dir
|
||||
print "* Removing Show-Recorder Temporary Directory"
|
||||
shutil.rmtree(config["base_recorded_files"])
|
||||
|
||||
#remove 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")
|
||||
|
||||
except Exception, e:
|
||||
print "Error %s" % e
|
|
@ -0,0 +1,15 @@
|
|||
from subprocess import Popen
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print "Waiting for show-recorder processes to stop..."
|
||||
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
except Exception, e:
|
||||
print e
|
||||
|
Loading…
Reference in New Issue