CC-2758: Make airtime-install script Debian/Ubuntu compatible
-initial commit
This commit is contained in:
parent
d26e410799
commit
8cafc52cad
16 changed files with 491 additions and 15 deletions
|
@ -16,7 +16,7 @@ if [[ "$DEB" = "Status: install ok installed" ]]; then
|
|||
fi
|
||||
|
||||
|
||||
#Check whether version of virtualenv is <= 1.4.5. If so exit install.
|
||||
#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)
|
||||
|
@ -71,13 +71,14 @@ python ${SCRIPTPATH}/../python_apps/media-monitor/install/media-monitor-install.
|
|||
|
||||
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
|
||||
|
||||
#allow monit to boot up before issuing commands
|
||||
#give monit some time to boot-up before issuing commands
|
||||
sleep 1
|
||||
|
||||
set +e
|
||||
|
|
92
install_minimal/airtime-install-new
Normal file
92
install_minimal/airtime-install-new
Normal file
|
@ -0,0 +1,92 @@
|
|||
#!/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 *********************************"
|
||||
|
||||
#copy files to
|
||||
## /etc/airtime
|
||||
#+ /etc/apache2/sites-available/airtime
|
||||
#+ /etc/apache2/sites-enabled/airtime
|
||||
## /etc/cron.d/
|
||||
## /etc/init.d/
|
||||
## /etc/monit/conf.d/
|
||||
# /usr/lib/airtime/airtime_virtualenv
|
||||
# /usr/lib/airtime/api_clients
|
||||
# /usr/lib/airtime/media-monitor
|
||||
# /srv/airtime
|
||||
# /usr/lib/airtime/pypo
|
||||
# /usr/lib/airtime/show-recorder
|
||||
## /usr/lib/airtime/utils
|
||||
## /usr/bin/airtime-*
|
||||
## /usr/share/airtime
|
||||
## /var/log/airtime
|
||||
## /var/tmp/airtime
|
||||
|
||||
# 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`
|
||||
|
||||
mkdir -p /etc/airtime
|
||||
cp $SCRIPTPATH/../airtime_mvc/build/airtime.conf /etc/airtime
|
||||
cp $SCRIPTPATH/../python_apps/api_clients/api_client.cfg /etc/airtime
|
||||
cp $SCRIPTPATH/../python_apps/show-recorder/recorder.cfg /etc/airtime
|
||||
cp $SCRIPTPATH/../python_apps/media-monitor/media-monitor.cfg /etc/airtime
|
||||
cp $SCRIPTPATH/../python_apps/pypo/pypo.cfg /etc/airtime
|
||||
cp $SCRIPTPATH/../python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg /etc/airtime
|
||||
|
||||
HOUR=$(($RANDOM%24))
|
||||
MIN=$(($RANDOM%60))
|
||||
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
||||
|
||||
cp $SCRIPTPATH/../python_apps/show-recorder/airtime-show-recorder-init-d /etc/init.d/airtime-show-recorder
|
||||
cp $SCRIPTPATH/../python_apps/media-monitor/airtime-media-monitor-init-d /etc/init.d/airtime-media-monitor
|
||||
cp $SCRIPTPATH/../python_apps/pypo/airtime-playout-init-d /etc/init.d/airtime-playout
|
||||
|
||||
cp $SCRIPTPATH/../python_apps/monit/monit-airtime-generic.cfg /etc/monit/conf.d/
|
||||
#cp $SCRIPTPATH/../python_apps/monit/monit-airtime-rabbitmq-server.cfg /etc/monit/conf.d/
|
||||
cp $SCRIPTPATH/../python_apps/media-monitor/monit-airtime-media-monitor.cfg /etc/monit/conf.d/
|
||||
cp $SCRIPTPATH/../python_apps/show-recorder/monit-airtime-show-recorder.cfg /etc/monit/conf.d/
|
||||
cp $SCRIPTPATH/../python_apps/pypo/monit-airtime-liquidsoap.cfg /etc/monit/conf.d/
|
||||
cp $SCRIPTPATH/../python_apps/pypo/monit-airtime-playout.cfg /etc/monit/conf.d/
|
||||
|
||||
cp -R $SCRIPTPATH/../utils /usr/lib/airtime
|
||||
|
||||
ln -s /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-import
|
||||
ln -s /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
|
||||
ln -s /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
|
||||
ln -s /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
|
||||
|
||||
cp -R $SCRIPTPATH/../airtime_mvc/* /usr/share/airtime/
|
||||
|
||||
mkdir -p /var/log/airtime
|
||||
mkdir -p /var/tmp/airtime
|
|
@ -15,10 +15,11 @@ require_once(dirname(__FILE__).'/AirtimeIni.php');
|
|||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
require_once(__DIR__.'/airtime-constants.php');
|
||||
|
||||
AirtimeInstall::ExitIfNotRoot();
|
||||
|
||||
$newInstall = false;
|
||||
$version = AirtimeInstall::GetVersionInstalled();
|
||||
|
||||
|
||||
|
||||
AirtimeInstall::ExitIfNotRoot();
|
||||
|
||||
require_once('Zend/Loader/Autoloader.php');
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
|
@ -41,8 +42,7 @@ try {
|
|||
)
|
||||
);
|
||||
$opts->parse();
|
||||
}
|
||||
catch (Zend_Console_Getopt_Exception $e) {
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
print $e->getMessage() .PHP_EOL;
|
||||
printUsage($opts);
|
||||
exit(1);
|
||||
|
@ -50,9 +50,10 @@ catch (Zend_Console_Getopt_Exception $e) {
|
|||
|
||||
if (isset($opts->h)) {
|
||||
printUsage($opts);
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$version = AirtimeInstall::GetVersionInstalled();
|
||||
// The current version is already installed.
|
||||
if (isset($version) && ($version != false) && ($version == AIRTIME_VERSION) && !isset($opts->r)) {
|
||||
echo "Airtime $version is already installed.".PHP_EOL;
|
||||
|
@ -83,6 +84,7 @@ if($version === false){
|
|||
// The only way we get here is if we are doing a new install or a reinstall.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
$newInstall = false;
|
||||
if(is_null($version)) {
|
||||
$newInstall = true;
|
||||
}
|
||||
|
@ -95,8 +97,7 @@ if (is_null($opts->r) && isset($opts->n)) {
|
|||
$overwrite = false;
|
||||
if (isset($opts->o) || $newInstall == true) {
|
||||
$overwrite = true;
|
||||
}
|
||||
else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
|
||||
} else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
|
||||
if (AirtimeIni::IniFilesExist()) {
|
||||
$userAnswer = "x";
|
||||
while (!in_array($userAnswer, array("o", "O", "p", "P", ""))) {
|
||||
|
@ -106,8 +107,7 @@ else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
|
|||
if (in_array($userAnswer, array("o", "O"))) {
|
||||
$overwrite = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$overwrite = true;
|
||||
}
|
||||
}
|
||||
|
@ -136,8 +136,7 @@ AirtimeInstall::InstallStorageDirectory();
|
|||
|
||||
if ($db_install) {
|
||||
if($newInstall) {
|
||||
// This is called with "passthru" so that we can pass in a parameter. See the file itself
|
||||
// for why we need to do this.
|
||||
//call external script. "y" argument means force creation of database tables.
|
||||
passthru('php '.__DIR__.'/airtime-db-install.php y');
|
||||
AirtimeInstall::DbConnect(true);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue