Reorder final setup steps

This commit is contained in:
Duncan Sommerville 2015-01-12 13:41:39 -05:00
parent 2b882cc313
commit 23f33cd8da
4 changed files with 28 additions and 58 deletions

View file

@ -5,10 +5,10 @@
<h3 class="form-title">Setup Complete!</h3> <h3 class="form-title">Setup Complete!</h3>
<span id="helpBlock" class="help-block help-message"></span> <span id="helpBlock" class="help-block help-message"></span>
<p> <p>
Looks like you're almost done! As a final step, run the following commands from the terminal:<br/> Looks like you're almost done! As a final step, run the following commands from the terminal:
<code>sudo service airtime-playout start</code><br/> <br/><code>sudo service airtime-playout start</code>
<code>sudo service airtime-liquidsoap start</code><br/> <br/><code>sudo service airtime-liquidsoap start</code>
<code>sudo service airtime-media-monitor start</code> <br/><code>sudo service airtime-media-monitor start</code>
</p> </p>
<p> <p>
Click "Done!" to bring up the Airtime configuration checklist; if your configuration is all green, Click "Done!" to bring up the Airtime configuration checklist; if your configuration is all green,
@ -23,11 +23,8 @@
</form> </form>
<script> <script>
$(document).ready(function() {
submitForm(e, "FinishSetup");
});
$("#finishSettingsForm").submit(function(e) { $("#finishSettingsForm").submit(function(e) {
window.location.replace("/?config"); window.location.replace("/?config");
// submitForm(e, "FinishSetup");
}); });
</script> </script>

View file

@ -1,47 +0,0 @@
<?php
/**
* User: sourcefabric
* Date: 09/12/14
*
* Class FinishSetup
*
* Wrapper class for finalizing and moving airtime.conf
*/
class FinishSetup extends Setup {
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
function __construct($settings) {
}
function runSetup() {
$message = null;
$errors = array();
if (file_exists("/etc/airtime/")) {
if (!$this->moveAirtimeConfig()) {
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
$errors[] = "ERR";
}
} else {
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
$errors[] = "ERR";
}
return array(
"message" => $message,
"errors" => $errors,
);
}
/**
* 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, self::AIRTIME_CONF_PATH)
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
}

View file

@ -25,7 +25,8 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDi
class MediaSetup extends Setup { class MediaSetup extends Setup {
const MEDIA_FOLDER = "mediaFolder"; const MEDIA_FOLDER = "mediaFolder";
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
static $path; static $path;
static $message = null; static $message = null;
static $errors = array(); static $errors = array();
@ -57,12 +58,32 @@ class MediaSetup extends Setup {
self::$message = "Invalid path!"; self::$message = "Invalid path!";
self::$errors[] = self::MEDIA_FOLDER; self::$errors[] = self::MEDIA_FOLDER;
} }
// Finalize and move airtime.conf.temp
if (file_exists("/etc/airtime/")) {
if (!$this->moveAirtimeConfig()) {
$message = "Error moving airtime.conf or deleting /tmp/airtime.conf.temp!";
$errors[] = "ERR";
}
} else {
$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
$errors[] = "ERR";
}
return array( return array(
"message" => self::$message, "message" => self::$message,
"errors" => self::$errors "errors" => self::$errors
); );
} }
/**
* 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, self::AIRTIME_CONF_PATH)
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
/** /**
* Add the given directory to cc_music_dirs * Add the given directory to cc_music_dirs

View file

@ -83,7 +83,6 @@ require_once('database-setup.php');
require_once('rabbitmq-setup.php'); require_once('rabbitmq-setup.php');
require_once('general-setup.php'); require_once('general-setup.php');
require_once('media-setup.php'); require_once('media-setup.php');
require_once('finish-setup.php');
// If airtime.conf exists, we shouldn't be here // If airtime.conf exists, we shouldn't be here
if (!file_exists("/etc/airtime/airtime.conf")) { if (!file_exists("/etc/airtime/airtime.conf")) {