CC-2166 Packaging improvements

Added command line options to the install process to overwrite or
preserve the existing config files.

Added the pypo-start/stop and recorder-start/stop symlinks to /usr/bin.

Renamed pypo-start.py to airtime-pypo-start.
Renamed pypo-stop.py to airtime-pypo-stop.
Renamed recorder-start.py to airtime-show-recorder-start.
Renamed recorder-stop.py to airtime-show-recorder-stop.

Renamed testrecordscript.py to recorder.py
This commit is contained in:
Paul Baranowski 2011-04-15 18:23:51 -04:00
parent 2b90008ef2
commit 173d82007f
14 changed files with 75 additions and 21 deletions

View file

@ -1,9 +1,10 @@
<?php
/**
* @package Airtime
* @copyright 2010 Sourcefabric O.P.S.
* @copyright 2011 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
echo PHP_EOL;
echo "******************************** Install Begin *********************************".PHP_EOL;
@ -12,9 +13,49 @@ require_once(dirname(__FILE__).'/include/AirtimeIni.php');
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
AirtimeInstall::ExitIfNotRoot();
AirtimeIni::ExitIfIniFilesExist();
echo "* Creating INI files".PHP_EOL;
AirtimeIni::CreateIniFiles();
require_once('Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
try {
$opts = new Zend_Console_Getopt(
array(
'help|h' => 'Displays usage information.',
'overwrite|o' => 'Overwrite any existing config files.',
'preserve|p' => 'Keep any existing config files.'
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
exit($e->getMessage() ."\n\n". $e->getUsageMessage());
}
if (isset($opts->h)) {
echo $opts->getUsageMessage();
exit;
}
$overwrite = false;
if (isset($opts->o)) {
$overwrite = true;
}
else if (!isset($opts->p) && !isset($opts->o)) {
if (AirtimeIni::IniFilesExist()) {
$userAnswer = "x";
while (!in_array($userAnswer, array("o", "O", "p", "P", ""))) {
echo PHP_EOL."You have existing config files. Do you want to (O)verwrite them, or (P)reserve them? (o/P) ";
$userAnswer = trim(fgets(STDIN));
}
if (in_array($userAnswer, array("o", "O"))) {
$overwrite = true;
}
}
}
if ($overwrite) {
echo "* Creating INI files".PHP_EOL;
AirtimeIni::CreateIniFiles();
}
AirtimeInstall::InstallPhpCode();
AirtimeInstall::InstallBinaries();