SAAS-83: Add ability to install Airtime components separately
-fixed
This commit is contained in:
parent
05dea59e55
commit
c48154ef2f
7 changed files with 195 additions and 154 deletions
|
@ -73,44 +73,47 @@ class AirtimeIni
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/api_clients/api_client.cfg", AirtimeIni::CONF_FILE_API_CLIENT)){
|
||||
echo "Could not copy api_client.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_API_CLIENT, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/pypo.cfg", AirtimeIni::CONF_FILE_PYPO)){
|
||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_PYPO, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", AirtimeIni::CONF_FILE_RECORDER)){
|
||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg", AirtimeIni::CONF_FILE_LIQUIDSOAP)){
|
||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/media-monitor/media-monitor.cfg", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
|
||||
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_MEDIAMONITOR, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
if (getenv("python_service") == "0"){
|
||||
if (!copy(__DIR__."/../../python_apps/api_clients/api_client.cfg", AirtimeIni::CONF_FILE_API_CLIENT)){
|
||||
echo "Could not copy api_client.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_API_CLIENT, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/pypo.cfg", AirtimeIni::CONF_FILE_PYPO)){
|
||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_PYPO, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", AirtimeIni::CONF_FILE_RECORDER)){
|
||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg", AirtimeIni::CONF_FILE_LIQUIDSOAP)){
|
||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!copy(__DIR__."/../../python_apps/media-monitor/media-monitor.cfg", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
|
||||
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
} else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_MEDIAMONITOR, self::CONF_PYPO_GRP)){
|
||||
echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,8 +228,10 @@ class AirtimeIni
|
|||
public static function UpdateIniFiles()
|
||||
{
|
||||
$api_key = AirtimeIni::GenerateRandomString();
|
||||
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_AIRTIME, 'api_key', $api_key);
|
||||
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_AIRTIME, 'airtime_dir', AirtimeInstall::CONF_DIR_WWW);
|
||||
if (getenv("web") == "t"){
|
||||
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_AIRTIME, 'api_key', $api_key);
|
||||
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_AIRTIME, 'airtime_dir', AirtimeInstall::CONF_DIR_WWW);
|
||||
}
|
||||
AirtimeIni::UpdateIniValue(AirtimeIni::CONF_FILE_API_CLIENT, 'api_key', "'$api_key'");
|
||||
}
|
||||
|
||||
|
|
|
@ -51,18 +51,23 @@ HOUR=$(($RANDOM%24))
|
|||
MIN=$(($RANDOM%60))
|
||||
echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons
|
||||
|
||||
#virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||
#. ${virtualenv_bin}activate
|
||||
|
||||
echo "* Creating /usr/lib/airtime"
|
||||
|
||||
if [ "$WEB_ONLY" -eq "0" ]; then
|
||||
if [ "$python_service" -eq "0" ]; then
|
||||
python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.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
|
||||
|
||||
if [ "$mediamonitor" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-copy-files.py
|
||||
fi
|
||||
if [ "$pypo" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py
|
||||
fi
|
||||
if [ "$showrecorder" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p /usr/lib/airtime
|
||||
cp -R $AIRTIMEROOT/utils /usr/lib/airtime
|
||||
|
||||
echo "* Creating symbolic links in /usr/bin"
|
||||
|
@ -72,10 +77,12 @@ ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update
|
|||
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/
|
||||
if [ "$web" = "t" ]; then
|
||||
echo "* Creating /usr/share/airtime"
|
||||
rm -rf "/usr/share/airtime"
|
||||
mkdir -p /usr/share/airtime
|
||||
cp -R $AIRTIMEROOT/airtime_mvc/* /usr/share/airtime/
|
||||
fi
|
||||
|
||||
echo "* Creating /var/log/airtime"
|
||||
mkdir -p /var/log/airtime
|
||||
|
|
|
@ -30,12 +30,17 @@ if [ "$DO_UPGRADE" -eq "0" ]; then
|
|||
fi
|
||||
set -e
|
||||
|
||||
if [ "$WEB_ONLY" -eq "0" ]; then
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
|
||||
if [ "$mediamonitor" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-initialize.py
|
||||
fi
|
||||
if [ "$pypo" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py
|
||||
fi
|
||||
if [ "$showrecorder" = "t" ]; then
|
||||
python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py
|
||||
fi
|
||||
|
||||
|
||||
# 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.
|
||||
|
@ -47,10 +52,15 @@ fi
|
|||
sleep 1
|
||||
|
||||
set +e
|
||||
if [ "$WEB_ONLY" -eq "0" ]; then
|
||||
|
||||
if [ "$mediamonitor" = "t" ]; then
|
||||
monit monitor airtime-media-monitor
|
||||
fi
|
||||
if [ "$pypo" = "t" ]; then
|
||||
monit monitor airtime-playout
|
||||
monit monitor airtime-liquidsoap
|
||||
monit monitor airtime-media-monitor
|
||||
fi
|
||||
if [ "$showrecorder" = "t" ]; then
|
||||
monit monitor airtime-show-recorder
|
||||
fi
|
||||
|
||||
|
|
|
@ -11,23 +11,8 @@ require_once(dirname(__FILE__).'/AirtimeIni.php');
|
|||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
require_once(__DIR__.'/airtime-constants.php');
|
||||
|
||||
$opts = AirtimeInstall::getOpts();
|
||||
if ($opts == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$version = AirtimeInstall::GetVersionInstalled();
|
||||
|
||||
// A previous version exists - if so, upgrade.
|
||||
/*
|
||||
if (isset($version) && ($version != false) && ($version < AIRTIME_VERSION) && !isset($opts->r)) {
|
||||
echo "Airtime version $version found.".PHP_EOL;
|
||||
|
||||
require_once("airtime-upgrade.php");
|
||||
exit(0);
|
||||
}
|
||||
* */
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// The only way we get here is if we are doing a new install or a reinstall.
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -38,14 +23,14 @@ if(is_null($version)) {
|
|||
}
|
||||
|
||||
$db_install = true;
|
||||
if (is_null($opts->r) && isset($opts->n)) {
|
||||
if (getenv("nodb")=="t") {
|
||||
$db_install = false;
|
||||
}
|
||||
|
||||
$overwrite = false;
|
||||
if (isset($opts->o) || $newInstall == true) {
|
||||
if (getenv("overwrite") == "t" || $newInstall == true) {
|
||||
$overwrite = true;
|
||||
} else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
|
||||
} else if (getenv("preserve") == "f" && getenv("overwrite") == "f" && getenv("reinstall") == "t") {
|
||||
if (AirtimeIni::IniFilesExist()) {
|
||||
$userAnswer = "x";
|
||||
while (!in_array($userAnswer, array("o", "O", "p", "P", ""))) {
|
||||
|
@ -80,7 +65,7 @@ if ($db_install) {
|
|||
if($newInstall) {
|
||||
//call external script. "y" argument means force creation of database tables.
|
||||
passthru('php '.__DIR__.'/airtime-db-install.php y');
|
||||
AirtimeInstall::DbConnect(true);
|
||||
//AirtimeInstall::DbConnect(true);
|
||||
} else {
|
||||
require_once('airtime-db-install.php');
|
||||
}
|
||||
|
|
|
@ -9,51 +9,32 @@
|
|||
* choose -r to reinstall.
|
||||
*
|
||||
* Returns 0 if Airtime is not installed
|
||||
* Returns 1 if a previous version of Airtime installed
|
||||
* Returns 2 if the same version of Airtime is installed
|
||||
* Returns 3 if a version of Airtime that we can't upgrade from is installed.
|
||||
* Returns 4 if we need to print help message.
|
||||
* Returns 5 if we need should only install apache files (web-only).
|
||||
* Returns 1 if the same version of Airtime already installed
|
||||
* Returns 2 if a previous version of Airtime is installed we can upgrade from
|
||||
* Returns 3 if a version of Airtime is installed that we can't upgrade from.
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
require_once(__DIR__.'/airtime-constants.php');
|
||||
|
||||
AirtimeInstall::ExitIfNotRoot();
|
||||
|
||||
$opts = AirtimeInstall::getOpts();
|
||||
|
||||
if (is_null($opts)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($opts->h)) {
|
||||
AirtimeInstall::printUsage($opts);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
//install media-monitor
|
||||
if (isset($opts->w)){
|
||||
exit(5);
|
||||
}
|
||||
|
||||
$version = AirtimeInstall::GetVersionInstalled();
|
||||
// The current version is already installed.
|
||||
echo "* Checking for existing install of Airtime...".PHP_EOL;
|
||||
if (isset($version) && ($version != false)){
|
||||
if (($version == AIRTIME_VERSION) && !isset($opts->r)) {
|
||||
echo "Airtime $version is already installed.".PHP_EOL;
|
||||
AirtimeInstall::printUsage($opts);
|
||||
exit(2);
|
||||
} else if (strcmp($version, AIRTIME_VERSION) < 0){
|
||||
echo " * Found previous version: $version".PHP_EOL;
|
||||
exit(1);
|
||||
if (isset($version)){
|
||||
if ($version === false){
|
||||
//version of Airtime older than 1.7.0 detected
|
||||
exit(3);
|
||||
} else {
|
||||
if (($version == AIRTIME_VERSION)) {
|
||||
//same version of Airtime is already installed
|
||||
exit(1);
|
||||
} else if (strcmp($version, AIRTIME_VERSION) < 0){
|
||||
//previous version of Airtime is installed.
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo " * Not Found".PHP_EOL;
|
||||
}
|
||||
|
||||
if($version === false){
|
||||
echo "A version of Airtime older than 1.7.0 detected, please upgrade to 1.7.0 first.\n";
|
||||
echo "You will then be able to upgrade to 1.9.0 using this installer.\n";
|
||||
exit(3);
|
||||
//no previous version of Airtime found
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue