diff --git a/airtime_mvc/public/js/setup/setup-config.js b/airtime_mvc/public/js/setup/setup-config.js index 9441ed44d..255beb93c 100644 --- a/airtime_mvc/public/js/setup/setup-config.js +++ b/airtime_mvc/public/js/setup/setup-config.js @@ -9,8 +9,12 @@ function cleanupStep(data, e) { // If there are no errors, we can continue with // the installation process if (data.errors.length == 0) { - // Call nextSlide from the submit button's context - nextSlide.call($(e.target)); + if ($(e.target).attr("id") == "finishSettingsForm") { + window.location.replace("/?config"); + } else { + // Call nextSlide from the submit button's context + nextSlide.call($(e.target)); + } } removeOverlay(); } diff --git a/airtime_mvc/public/setup/finish-setup.php b/airtime_mvc/public/setup/finish-setup.php index 704164c14..a79b5bf4b 100644 --- a/airtime_mvc/public/setup/finish-setup.php +++ b/airtime_mvc/public/setup/finish-setup.php @@ -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"; } + + return array( + "message" => $message, + "errors" => $errors, + ); } - function createAirtimeConfigDirectory() { - return file_exists("/etc/airtime/") ? true - : mkdir("/etc/airtime/", 0755, true); + 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); } } \ No newline at end of file