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
// the installation process
if (data.errors.length == 0) {
if ($(e.target).attr("id") == "finishSettingsForm") {
window.location.replace("/?config");
} else {
// Call nextSlide from the submit button's context
nextSlide.call($(e.target));
}
}
removeOverlay();
}

View file

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