CC-2758: Make airtime-install script Debian/Ubuntu compatible

-initial commit
This commit is contained in:
Martin Konecny 2011-10-27 14:01:59 -04:00
parent d26e410799
commit 8cafc52cad
16 changed files with 491 additions and 15 deletions

View file

@ -15,10 +15,11 @@ require_once(dirname(__FILE__).'/AirtimeIni.php');
require_once(dirname(__FILE__).'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php');
AirtimeInstall::ExitIfNotRoot();
$newInstall = false;
$version = AirtimeInstall::GetVersionInstalled();
AirtimeInstall::ExitIfNotRoot();
require_once('Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
@ -41,8 +42,7 @@ try {
)
);
$opts->parse();
}
catch (Zend_Console_Getopt_Exception $e) {
} catch (Zend_Console_Getopt_Exception $e) {
print $e->getMessage() .PHP_EOL;
printUsage($opts);
exit(1);
@ -50,9 +50,10 @@ catch (Zend_Console_Getopt_Exception $e) {
if (isset($opts->h)) {
printUsage($opts);
exit(1);
exit(0);
}
$version = AirtimeInstall::GetVersionInstalled();
// The current version is already installed.
if (isset($version) && ($version != false) && ($version == AIRTIME_VERSION) && !isset($opts->r)) {
echo "Airtime $version is already installed.".PHP_EOL;
@ -83,6 +84,7 @@ if($version === false){
// The only way we get here is if we are doing a new install or a reinstall.
// -------------------------------------------------------------------------
$newInstall = false;
if(is_null($version)) {
$newInstall = true;
}
@ -95,8 +97,7 @@ if (is_null($opts->r) && isset($opts->n)) {
$overwrite = false;
if (isset($opts->o) || $newInstall == true) {
$overwrite = true;
}
else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
} else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
if (AirtimeIni::IniFilesExist()) {
$userAnswer = "x";
while (!in_array($userAnswer, array("o", "O", "p", "P", ""))) {
@ -106,8 +107,7 @@ else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
if (in_array($userAnswer, array("o", "O"))) {
$overwrite = true;
}
}
else {
} else {
$overwrite = true;
}
}
@ -136,8 +136,7 @@ AirtimeInstall::InstallStorageDirectory();
if ($db_install) {
if($newInstall) {
// This is called with "passthru" so that we can pass in a parameter. See the file itself
// for why we need to do this.
//call external script. "y" argument means force creation of database tables.
passthru('php '.__DIR__.'/airtime-db-install.php y');
AirtimeInstall::DbConnect(true);
} else {