From c8a17eb7431d5bafb33102e79634acea1ec233b5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 22 Mar 2021 10:00:33 +0100 Subject: [PATCH] Fix --- scripts/backup | 3 ++- scripts/change_url | 2 +- scripts/install | 6 ++++-- scripts/remove | 3 ++- scripts/restore | 5 +++-- scripts/upgrade | 7 ++++--- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 77fc8c4..073460e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -24,6 +24,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -52,7 +53,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # BACKUP CONFIG #================================================= -ynh_backup --src_path="/home/yunohost.app/$app" +ynh_backup --src_path="$config_path" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index e0dfd7b..2265478 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -109,7 +109,7 @@ fi ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Available at http" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Available at http" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index bc5b1bc..28cd8db 100644 --- a/scripts/install +++ b/scripts/install @@ -34,6 +34,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app +config_path=/home/yunohost.app/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -46,6 +47,7 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=config_path --value=$config_path #================================================= # STANDARD MODIFICATIONS @@ -103,7 +105,7 @@ ynh_script_progression --message="Modifying a config file..." mkdir -p /home/yunohost.app/$app -ynh_add_config --template="../conf/config.js" --destination="/home/yunohost.app/$app/config.js" +ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js" #================================================= # INSTALL THE LOUNGE @@ -135,7 +137,7 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R $app: $final_path -chown -R $app: /home/yunohost.app/$app +chown -R $app: $config_path #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/remove b/scripts/remove index 81a9a71..a09d08f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) #================================================= # STANDARD REMOVE @@ -72,7 +73,7 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing the config file..." -ynh_secure_remove --file="/home/yunohost.app/$app" +ynh_secure_remove --file="$config_path" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index c45d9ff..8d34e05 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +config_path=$(ynh_app_setting_get --app=$app --key=config_path) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -69,7 +70,7 @@ ynh_restore_file --origin_path="$final_path" #================================================= ynh_script_progression --message="Restoring the config path..." -ynh_restore_file --origin_path="/home/yunohost.app/$app" +ynh_restore_file --origin_path="$config_path" #================================================= # RESTORE USER RIGHTS @@ -78,7 +79,7 @@ ynh_script_progression --message="Restoring user rights..." # Restore permissions to app files chown -R $app: $final_path -chown -R $app: /home/yunohost.app/$app +chown -R $app: $config_path #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index c011556..0865c5c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,6 +43,7 @@ fi # If config_path doesn't exist, create it if [ -z "$config_path" ]; then config_path=/home/yunohost.app/$app + mkdir -p /home/yunohost.app/$app ynh_app_setting_set --app=$app --key=config_path --value=$config_path fi @@ -75,7 +76,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # CREATE DEDICATED USER @@ -139,7 +140,7 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." -ynh_add_config --template="../conf/config.js" --destination="/home/yunohost.app/$app/config.js" +ynh_add_config --template="../conf/config.js" --destination="$config_path/config.js" #================================================= # SETUP SYSTEMD @@ -160,7 +161,7 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R $app: $final_path -chown -R $app: /home/yunohost.app/$app +chown -R $app: $config_path #================================================= # GENERIC FINALIZATION