From dca89fe3e5e064761d9f7f0b9d1b708ecb304ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Collin?= Date: Thu, 15 Feb 2024 15:30:59 +0100 Subject: [PATCH] Fix for double upgrade --- scripts/upgrade | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a89f932..d8e98b2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,13 +41,14 @@ if [[ -n "${document_path:-}" ]]; then ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir" fi -# document dir has moved from html_path to data_dir, so set the variable accordingly -if [[ ${document_dir} == ${html_path}* ]]; then - document_dir=$data_dir/docs - ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir" -fi - if [[ -n "${html_path:-}" ]]; then + + # document dir has moved from html_path to data_dir, so set the variable accordingly + if [[ ${document_dir} == ${html_path}* ]]; then + document_dir=$data_dir/docs + ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir" + fi + # Migrate html_path to data_dir mv "$html_path/index.html" "$html_path/docs" "$data_dir" old_doc_dir="$html_path/docs" @@ -62,6 +63,7 @@ if [[ -n "${html_path:-}" ]]; then ynh_backup_if_checksum_is_different --file="$install_dir/.env" ynh_replace_string --match_string="$old_doc_dir" --replace_string="$document_dir" --target_file="$install_dir/.env" ynh_store_file_checksum --file="$install_dir/.env" + fi # Regenerate the .env file if the document_url was incorrectly set before