From 5c1fe076f475466f16ec45da368b03da0e7ee89a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 20 Feb 2021 16:11:58 +0100 Subject: [PATCH] Fix --- scripts/restore | 2 +- scripts/upgrade | 40 ++++++++++++++-------------------------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/scripts/restore b/scripts/restore index 4aa9d61..8c557bc 100755 --- a/scripts/restore +++ b/scripts/restore @@ -180,7 +180,7 @@ chown -R $app:root $final_path chmod -R 755 $final_path chown -R $app:root /var/log/$app chown -R $app:root /etc/$app -chown turnserver:root $coturn_config_path +chown turnserver:root /etc/$app/coturn.conf chmod -R u=rwX,g=rX,o= /etc/$app chmod 770 $final_path/Coturn_config_rotate.sh setfacl -R -m user:turnserver:rX /etc/$app diff --git a/scripts/upgrade b/scripts/upgrade index 2e97ba2..4363001 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,20 +47,6 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -if [ -z "$final_path/groups" ]; then - # Define app's groups directory - groups="$final_path/groups" - #Create groups folder - mkdir -p "$groups" -fi - -if [ -z "$final_path/data" ]; then - # Define app's data directory - data="$final_path/data" - # Create data folder - mkdir -p "$data" -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -103,12 +89,26 @@ then ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + groups="$final_path/groups" + data="$final_path/data" + + mkdir -p "$groups" + mkdir -p "$data" + # Copy the admin saved settings from tmp directory to final path cp -ar "$tmpdir/groups" "$final_path/groups" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" + ynh_backup_if_checksum_is_different --file="$final_path/data/passwd" + ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd" + ynh_store_file_checksum --file="$final_path/data/passwd" + + ynh_backup_if_checksum_is_different --file="$final_path/data/ice-servers.json" + ynh_add_config --template="../conf/ice-servers.json" --destination="$final_path/data/ice-servers.json" + ynh_store_file_checksum --file="$final_path/data/ice-servers.json" + # Recreate certificates pushd "$final_path/data" ynh_exec_warn_less openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem \ @@ -207,18 +207,6 @@ ynh_replace_string --match_string=__IPV4__ --replace_string=$public_ip4 --target ynh_replace_string --match_string=__IPV6__ --replace_string=$public_ip6 --target_file="$final_path/Coturn_config_rotate.sh" chmod +x $final_path/Coturn_config_rotate.sh -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -ynh_backup_if_checksum_is_different --file="$final_path/data/passwd" -ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd" -ynh_store_file_checksum --file="$final_path/data/passwd" - -ynh_backup_if_checksum_is_different --file="$final_path/data/ice-servers.json" -ynh_add_config --template="../conf/ice-servers.json" --destination="$final_path/data/ice-servers.json" -ynh_store_file_checksum --file="$final_path/data/ice-servers.json" - #================================================= # NGINX CONFIGURATION #=================================================