Updated final install step

This commit is contained in:
Duncan Sommerville 2014-12-15 09:52:10 -05:00
parent 4583be981d
commit 5f315abb79
2 changed files with 26 additions and 8 deletions

View file

@ -9,9 +9,13 @@ function cleanupStep(data, e) {
// If there are no errors, we can continue with // If there are no errors, we can continue with
// the installation process // the installation process
if (data.errors.length == 0) { if (data.errors.length == 0) {
if ($(e.target).attr("id") == "finishSettingsForm") {
window.location.replace("/?config");
} else {
// Call nextSlide from the submit button's context // Call nextSlide from the submit button's context
nextSlide.call($(e.target)); nextSlide.call($(e.target));
} }
}
removeOverlay(); removeOverlay();
} }

View file

@ -14,18 +14,32 @@ class FinishSetup extends Setup {
} }
function runSetup() { function runSetup() {
if ($this->createAirtimeConfigDirectory()) { $message = null;
$this->moveAirtimeConfig(); $errors = array();
if ($this->checkAirtimeConfigDirectory()) {
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";
} }
function createAirtimeConfigDirectory() { return array(
return file_exists("/etc/airtime/") ? true "message" => $message,
: mkdir("/etc/airtime/", 0755, true); "errors" => $errors,
);
}
function checkAirtimeConfigDirectory() {
return file_exists("/etc/airtime/");
} }
function moveAirtimeConfig() { function moveAirtimeConfig() {
return copy(AIRTIME_CONF_TEMP_PATH, "/etc/airtime/airtime.conf"); return copy(AIRTIME_CONF_TEMP_PATH, "/etc/airtime/airtime.conf")
&& unlink(AIRTIME_CONF_TEMP_PATH);
} }
} }