From 288d064589743c28dfd117b95b5ef20284930df1 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 16 Mar 2024 13:55:53 +0100 Subject: [PATCH] Conditional config_file upgrade avoids a warning if the file has not been generated --- scripts/upgrade | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2f69fc1..8bf316b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,10 +48,12 @@ chown $app:$app "$install_dir/live/.env" # Fix SMTP configuration config_file=$data_dir/config.json -cat <<< $(jq -r --arg domain "$domain" '.smtp_host = $domain' $config_file) > $config_file -cat <<< $(jq -r '.smtp_security = "starttls"' $config_file) > $config_file -if [ ! -s "$config_file" ]; then - ynh_die --message="Something went wrong while setting up the configuration file: it ended up empty." +if [ -e "$config_file" ]; then + cat <<< $(jq -r --arg domain "$domain" '.smtp_host = $domain' $config_file) > $config_file + cat <<< $(jq -r '.smtp_security = "starttls"' $config_file) > $config_file + if [ ! -s "$config_file" ]; then + ynh_die --message="Something went wrong while setting up $config_file: it ended up empty." + fi fi #=================================================