From f52938879e75abe04ca4b88e42bd99edcb23df73 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Tue, 7 Apr 2020 03:32:36 +0200 Subject: [PATCH] try to debug upgrade --- scripts/upgrade | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 699be32..a80ce44 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) || ynh_die "This path already contains a folder" - #================================================= # CHECK VERSION #================================================= @@ -38,7 +37,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= - ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 # Fix is_public as a boolean value @@ -55,8 +53,18 @@ fi #================================================= ynh_script_progression --message="Backing up the bdd and squelettes before upgrading (may take a while)..." --time --weight=1 -cp -avr /var/www/garradin/association.sqlite /tmp/association.sqlite -cp -avr /var/www/garradin/www/squelettes /tmp/squelettes +bdd=/var/www/garradin/association.sqlite +squelettes=/var/www/garradin//www/squelettes + +if [ -d "$squelettes" ] +then + cp -ar $squelettes /tmp/squelettes +fi + +if [ -b "$bdd" ] +then + cp -ar $bdd /tmp/association.sqlite +fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -106,11 +114,10 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --time --weight=1 if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" fi @@ -130,9 +137,17 @@ ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string #================================================= # backup bdd, squelettes directory and config.local.php #================================================= +backup_bdd=/tmp/association.sqlite +backup_squelettes=/tmp/squelettes -sudo cp -a /tmp/association.sqlite $final_path/association.sqlite -sudo cp -avr /tmp/squelettes $final_path/www/squelettes +if [ -d "$backup_squelettes" ] +then + cp -ar /tmp/squelettes $final_path/www/squelettes +fi + +if [ -b "$backup_bdd" ] + cp -ar /tmp/association.sqlite $final_path/association.sqlite +fi #================================================= # NGINX CONFIGURATION @@ -142,7 +157,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config - #================================================= # CREATE DEDICATED USER #=================================================