diff --git a/scripts/upgrade b/scripts/upgrade index a336a25..c2b9ad2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,7 +25,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # CHECK VERSION #================================================= -upgrade_type=$(ynh_check_app_version_changed) +if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then + upgrade_type="0.9.8" +elif ynh_compare_current_package_version --comparison le --version 1.0.7~ynh2; then + upgrade_type="1.1.0" +else + upgrade_type=$(ynh_check_app_version_changed) +fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -79,11 +85,11 @@ fi # UPGRADE TO 0.9.8 if necessary #================================================= -if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1 - +if [ "$upgrade_type" == "0.9.8" ] then ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5 - # Download, check integrity, uncompress and patch the source from 0.9.8.src + + # Download, check integrity, uncompress and patch the source from 0.9.8.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="0.9.8" # Set permissions on app files ynh_system_user_create --username=$app @@ -95,14 +101,14 @@ then backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes - if [ -d "$backup_squelettes" ] + if [ -d "$backup_squelettes" ] then cp -ar $backup_squelettes $final_path/www/squelettes - fi + fi if [ -e "$backup_bdd" ] then - cp -a $backup_bdd $final_path/association.sqlite + cp -a $backup_bdd $final_path/association.sqlite fi chown -R $app:$app $final_path @@ -129,10 +135,11 @@ fi # UPGRADE TO 1.1.0 if necessary #================================================= -if ynh_compare_current_package_version --comparison lt --version 0.1.1.0~ynh1 +if [ "$upgrade_type" == "1.1.0" ] then ynh_script_progression --message="Upgrading upgrade to 1.1.0" --weight=5 - # Download, check integrity, uncompress and patch the source from 0.9.8.src + + # Download, check integrity, uncompress and patch the source from 1.1.0.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="1.1.0" # Set permissions on app files ynh_system_user_create --username=$app @@ -263,4 +270,4 @@ chmod 440 "$final_path/config.local.php" # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Garradin completed" --last +ynh_script_progression --message="Upgrade of Garradin completed" --last \ No newline at end of file