From 76b51ec84084968a721a5e67094db7119e112dfb Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 21 Jan 2024 17:11:51 +0100 Subject: [PATCH] Standardize permission management --- scripts/install | 12 +++--------- scripts/restore | 3 +++ scripts/upgrade | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 4755042..e19734e 100755 --- a/scripts/install +++ b/scripts/install @@ -84,6 +84,9 @@ if [ "$domain" != "$mqtt_domain" ]; then mosquitto_passwd -U "/etc/mosquitto/conf.d/"$app"_credentials" ynh_print_info --message="The credential to the mosquitto server has been saved in the settings of the app" +else + #If no MQTT have been set, we delete the mqtt permission. + ynh_permission_delete --permission="mqtt" fi @@ -161,15 +164,6 @@ fi # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="$log_file" --failregex="^.*Error: Failed login attempt from .*$" --max_retry=5 -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." - - -#If no MQTT have been set, we delete the mqtt permission. -[[ "$domain" == "$mqtt_domain" ]] && ynh_permission_delete --permission="mqtt" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 96056d2..e5c2de0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -70,6 +70,9 @@ chown -R "$app":"$app" "$install_dir" if [ "$domain" != "$mqtt_domain" ]; then ynh_script_progression --message="Reinstalling up mosquitto..." --weight=5 ynh_restore_file --origin_path="/etc/mosquitto/conf.d" --not_mandatory +else + #If no MQTT have been set, we delete the mqtt permission. + ynh_permission_delete --permission="mqtt" fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4ec90c2..ee61431 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -124,7 +124,7 @@ if [ "$domain" != "$mqtt_domain" ]; then fi else #If no MQTT have been set, we delete the mqtt permission. - [[ "$domain" == "$mqtt_domain" ]] && ynh_permission_delete --permission="mqtt" + ynh_permission_delete --permission="mqtt" fi #=================================================