CC-3072: Test upgrade to 2.0.0 from 1.8.0 and up (including minor versions, except 1.9.1)

This commit is contained in:
Martin Konecny 2011-11-23 13:59:10 -05:00
parent 8231df6c44
commit d71c2289ac
4 changed files with 54 additions and 7 deletions

View File

@ -7,6 +7,8 @@ if [ `whoami` != 'root' ]; then
exit 1
fi
export AIRTIME_INSTALL_DEBUG=1
set +e
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
set -e
@ -22,7 +24,14 @@ SCRIPTPATH=`dirname $SCRIPT`
AIRTIMEROOT=$SCRIPTPATH/../
# Check if airtime exists already
set +e
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-installed-check.php $@
result=$?
set -e
if [ "$result" = "2" -o "$result" = "3" ]; then
exit 1
fi
echo -e "\n******************************** Install Begin *********************************"
@ -30,6 +39,11 @@ rm -rf "/usr/lib/airtime"
$AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh
python $AIRTIMEROOT/python_apps/create-pypo-user.py
if [ "$result" = "1" ]; then
#do upgrade
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-upgrade.php $@
fi
$SCRIPTPATH/include/airtime-copy-files.sh
$SCRIPTPATH/include/airtime-initialize.sh $@

View File

@ -19,12 +19,14 @@ if ($opts == NULL) {
$version = AirtimeInstall::GetVersionInstalled();
// A previous version exists - if so, upgrade.
/*
if (isset($version) && ($version != false) && ($version < AIRTIME_VERSION) && !isset($opts->r)) {
echo "Airtime version $version found.".PHP_EOL;
require_once("airtime-upgrade.php");
exit(0);
}
* */
// -------------------------------------------------------------------------
// The only way we get here is if we are doing a new install or a reinstall.

View File

@ -7,6 +7,11 @@
* Checks if a current version of Airtime is installed.
* If so, the user is presented with the help menu and can
* choose -r to reinstall.
*
* Returns 0 if Airtime is not installed
* Returns 1 if a previous version of Airtime installed
* Returns 2 if the same version of Airtime is installed
* Returns 3 if a version of Airtime that we can't upgrade from is installed.
*/
require_once(dirname(__FILE__).'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php');
@ -15,20 +20,28 @@ AirtimeInstall::ExitIfNotRoot();
$opts = AirtimeInstall::getOpts();
if ($opts == NULL) {
exit(1);
exit(2);
}
if (isset($opts->h)) {
AirtimeInstall::printUsage($opts);
exit(1);
exit(2);
}
$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;
AirtimeInstall::printUsage($opts);
exit(1);
echo "* Checking for existing install of Airtime...".PHP_EOL;
if (isset($version) && ($version != false)){
if (($version == AIRTIME_VERSION) && !isset($opts->r)) {
echo "Airtime $version is already installed.".PHP_EOL;
AirtimeInstall::printUsage($opts);
exit(2);
} else if (strcmp($version, AIRTIME_VERSION) < 0){
echo " * Found previous version: $version".PHP_EOL;
exit(1);
}
} else {
echo " * Not Found".PHP_EOL;
}
if($version === false){

View File

@ -19,6 +19,14 @@ if(exec("whoami") != "root"){
exit(1);
}
function pause(){
/* change "AIRTIME_INSTALL_DEBUG=1" in base install file to enable this. */
if (getenv("AIRTIME_INSTALL_DEBUG") === "1"){
echo "Press Enter to Continue".PHP_EOL;
fgets(STDIN);
}
}
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
@ -58,33 +66,43 @@ $SCRIPTPATH = __DIR__;
if (strcmp($version, "1.7.0") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.7.0/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.8.0") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.8.0/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.8.1") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.8.1/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.8.2") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.8.2/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.9.0") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.0/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.9.2") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.2/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.9.3") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.3/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.9.4") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.4/airtime-upgrade.php");
pause();
}
if (strcmp($version, "1.9.5") < 0){
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-1.9.5/airtime-upgrade.php");
pause();
}
if (strcmp($version, "2.0.0") < 0){
system("php ".__DIR__."/../upgrades/airtime-2.0.0/airtime-upgrade.php");
pause();
}
//set the new version in the database.