1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dont-code_ynh.git synced 2024-09-03 18:26:34 +02:00

Fix for double upgrade

This commit is contained in:
Gérard Collin 2024-02-15 15:30:59 +01:00
parent 6dc077b631
commit dca89fe3e5

View file

@ -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