From 4944504589ea7862fb39087451f2a58d4308f3d1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Nov 2020 22:56:21 +0100 Subject: [PATCH] Fix --- check_process | 12 +++++------- manifest.json | 2 +- scripts/restore | 5 ++--- scripts/upgrade | 41 +++++++++++++++++++++++++++++------------ 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/check_process b/check_process index dd3f2b4..01aec69 100644 --- a/check_process +++ b/check_process @@ -1,5 +1,4 @@ ;; Test complet - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -15,12 +14,11 @@ upgrade=1 backup_restore=1 multi_instance=0 - wrong_user=0 - wrong_path=1 - incorrect_path=1 - corrupt_source=0 - fail_download_source=0 + incorrect_path=0 port_already_use=0 - final_path_already_use=0 + change_url=0 ;;; Levels Level 5=auto +;;; Options +Email= +Notification=none diff --git a/manifest.json b/manifest.json index 6104730..7c7ed2b 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "1.2~ynh1", "url": "https://jappix.org/", - "license": "AGPL-3", + "license": "AGPL-3.0-only", "maintainer": { "name": "titoko", "email": "titoko@titoko.fr" diff --git a/scripts/restore b/scripts/restore index fcbed7f..df9bac5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -19,7 +18,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -30,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=2 +ynh_script_progression --message="Validating restoration parameters..." --weight=2 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" diff --git a/scripts/upgrade b/scripts/upgrade index 4c6d22e..fd72886 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) name=$(ynh_app_setting_get "$app" name) language=$(ynh_app_setting_get "$app" language) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -43,7 +44,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -58,30 +59,46 @@ ynh_abort_if_errors # Copy files to the right place #================================================= -final_path="/var/www/${app}" -ynh_app_setting_set $app final_path $final_path -SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --weight=6 + +ynh_setup_source --dest_dir=$final_path + mkdir -p "${final_path}/store/conf" cp ../conf/*.xml "${final_path}/store/conf/" +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + # Set permissions to jappix directory -sudo chown -R www-data: "$final_path" +chown -R www-data: $final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config - - +#================================================= # Set Jappix configuration -sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml" -sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml" -sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml" -sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml" +#================================================= + +cp ../conf/hosts.xml $final_path/store/conf/hosts.xml + +ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$final_path/store/conf/hosts.xml" +ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$final_path/store/conf/hosts.xml" + +cp ../conf/main.xml $final_path/store/conf/main.xml + +ynh_replace_string --match_string="__LANGUAGE__" --replace_string=$language --target_file="$final_path/store/conf/main.xml" +ynh_replace_string --match_string="__NAME__" --replace_string=$name --target_file="$final_path/store/conf/main.xml" #================================================= # RELOAD NGINX