Initial work on monitless installation

This commit is contained in:
Duncan Sommerville 2014-12-16 12:24:41 -05:00
parent ecb43c2587
commit 4dfd49d12c
23 changed files with 225 additions and 112 deletions

View file

@ -9,6 +9,8 @@
* Wrapper class for finalizing and moving airtime.conf
*/
class FinishSetup extends Setup {
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
function __construct($settings) {
}
@ -17,7 +19,7 @@ class FinishSetup extends Setup {
$message = null;
$errors = array();
if ($this->checkAirtimeConfigDirectory()) {
if (file_exists("/etc/airtime/")) {
if (!$this->moveAirtimeConfig()) {
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
$errors[] = "ERR";
@ -26,20 +28,31 @@ class FinishSetup extends Setup {
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
$errors[] = "ERR";
}
if (empty($errors)) {
// Write service configurations for pypo and media-monitor
$this->startServices();
}
return array(
"message" => $message,
"errors" => $errors,
);
}
function checkAirtimeConfigDirectory() {
return file_exists("/etc/airtime/");
}
/**
* Moves /tmp/airtime.conf.temp to /etc/airtime.conf and then removes it to complete setup
* @return boolean false if either of the copy or removal operations fail
*/
function moveAirtimeConfig() {
return copy(AIRTIME_CONF_TEMP_PATH, "/etc/airtime/airtime.conf")
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
function startServices() {
exec("service airtime-media-monitor start-with-monit");
exec("service airtime-playout start-with-monit");
exec("service airtime-liquidsoap start-with-monit");
}
}