From 903b8426fe884fa7b1ffc0d779a05272f148efef Mon Sep 17 00:00:00 2001 From: ljf Date: Thu, 8 Apr 2021 20:30:50 +0200 Subject: [PATCH] [fix] Add default value for new params --- scripts/upgrade | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 382b029..e2f6989 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,9 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME ssh_user=$(ynh_app_setting_get --app=$app --key=ssh_user) +public_key=$(ynh_app_setting_get --app=$app --key=public_key) +alert_delay=$(ynh_app_setting_get --app=$app --key=alert_delay) +alert_mails=$(ynh_app_setting_get --app=$app --key=alert_mails) #================================================= # CHECK IF AN UPGRADE IS NEEDED @@ -59,6 +62,12 @@ if echo "$public_key" | grep -q -v ' '; then ynh_app_setting_set --app=$app --key=public_key --value="$(grep -Po 'no-user-rc \K.*$' /home/$ssh_user/.ssh/authorized_keys)" fi +# Alert delay and alert mail missing +if [ -z "$alert_delay" ]; then + ynh_app_setting_set --app=$app --key=alert_delay --value=1 + ynh_app_setting_set --app=$app --key=alert_mails --value="root" +fi + # Reinstall borg if debian change of major version if [ ! -f "/opt/borg-env/$(ynh_get_debian_release)" ] ; then ynh_secure_remove /opt/borg-env