From c876b83bbe1bfa5478c715370d5f7199c2b70dbd Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 6 Nov 2021 10:41:58 +0100 Subject: [PATCH] Fix change url --- doc/DISCLAIMER.md | 2 +- scripts/change_url | 13 +++++++++++++ scripts/upgrade | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 9550efe..14bf2f8 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -7,7 +7,7 @@ Groups are defined by JSON files located in the folder `/home/yunohost.app/galene/groups`. Each group is represented by a `GroupName.json` file. To create a new group, you need to create a `GroupNameExample.json` file and restart Galène service (you can also make subfolder groups, and the groups will be accessible with `https://domain.tld/group/subfolder/GroupName`). Various configuration options are available (see https://github.com/YunoHost-Apps/galene_ynh/wiki/Configuration-file). -When Galène is removed, the data directory (`/home/yunohost.app/galene/`) is preserved. If you want to remove it along with Galène, use the `--purge option`: `sudo yunohost app remove galene --purge`. +When Galène is removed, the data directory (`/home/yunohost.app/galene/`) is preserved. If you want to remove it along with Galène, use the `--purge` option: `sudo yunohost app remove galene --purge`. *NB: Spaces are supported in group file names.* diff --git a/scripts/change_url b/scripts/change_url index d650a59..6d0abea 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +admin=$(ynh_app_setting_get --app=$app --key=admin) +password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -101,6 +103,17 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# CREATE DATA AND GROUPS FOLDER +#================================================= +ynh_script_progression --message="Updating configuration file..." --weight=2 + +domain="$new_domain" +ynh_add_config --template="../conf/config.json" --destination="$final_path/data/config.json" + +chmod 400 "$final_path/data/config.json" +chown $app:$app "$final_path/data/config.json" + #================================================= # GENERIC FINALISATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 43a4fff..7548c6d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -114,6 +114,11 @@ chown -R $app:www-data "$final_path" # Create data folder mkdir -p "$final_path/data" +# We remove the old admin/password file if present +if [ -f "$final_path/data/passwd" ] ; then + ynh_secure_remove --file="$final_path/data/passwd" +fi + ynh_add_config --template="../conf/config.json" --destination="$final_path/data/config.json" chmod 400 "$final_path/data/config.json"