From 396bc1d72c5d4614a87c746970a1d49c453f7a73 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 1 Jun 2019 07:05:15 +0200 Subject: [PATCH] adding checksum --- scripts/install | 7 +++++++ scripts/upgrade | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c9d3d34..9e61390 100644 --- a/scripts/install +++ b/scripts/install @@ -204,6 +204,13 @@ ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.serv ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum --file="$configfile" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2db5b62..f3df721 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -168,7 +168,7 @@ virtualenv -p python3 "$final_path/code/virtualenv" #================================================= configfile="$final_path/code/config/.env" - +ynh_backup_if_checksum_is_different --file="$configfile" cp ../conf/env.prod "$configfile" key=$(ynh_string_random) @@ -226,6 +226,13 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" python api/manage.py script delete_pre_017_federated_uploads --no-input ) +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$configfile" + #================================================= # SETUP SYSTEMD #=================================================