From 95f8a53d877c7d0a4b6d5e8324f83546e8bc6a65 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 27 Dec 2023 19:56:29 +0100 Subject: [PATCH] Better user information about ports opening / closing --- scripts/config | 16 ++++++++-------- scripts/install | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/config b/scripts/config index f18214f..a2d552d 100644 --- a/scripts/config +++ b/scripts/config @@ -18,15 +18,15 @@ ynh_abort_if_errors set__open_port_53() { if [ "$open_port_53" == "true" ]; then - ynh_script_progression --message="Opening port 53..." + ynh_print_info --message="Opening port 53..." # if the user would expose port 53 to the Internet, open it ynh_exec_warn_less yunohost firewall allow Both 53 - yunohost firewall reload + ynh_exec_warn_less yunohost firewall reload elif [ "$open_port_53" == "false" ]; then # else if false, close it - ynh_script_progression --message="Closing port 53..." + ynh_print_info --message="Closing port 53..." ynh_exec_warn_less yunohost firewall disallow Both 53 - yunohost firewall reload + ynh_exec_warn_less yunohost firewall reload else # else, throw error ynh_print_warn --message="The variable 'open_port_53' should be 'true' or 'false' but isn't, please report this." @@ -49,17 +49,17 @@ set__open_port_53() { set__dns_over_https() { if [ "$dns_over_https" == "true" ]; then - ynh_script_progression --message="Opening DoH and DoQ ports..." + ynh_print_info --message="Opening DoH and DoQ ports..." # if DNS over HTTPS/QUIC is activated, open the associated ports ynh_exec_warn_less yunohost firewall allow Both "$port_dns_over_http" ynh_exec_warn_less yunohost firewall allow UDP "$port_dns_over_quic" - yunohost firewall reload + ynh_exec_warn_less yunohost firewall reload elif [ "$dns_over_https" == "false" ]; then # else if false, close them - ynh_script_progression --message="Closing DoH and DoQ ports..." + ynh_print_info --message="Closing DoH and DoQ ports..." ynh_exec_warn_less yunohost firewall disallow Both "$port_dns_over_http" ynh_exec_warn_less yunohost firewall disallow UDP "$port_dns_over_quic" - yunohost firewall reload + ynh_exec_warn_less yunohost firewall reload else # else, throw error ynh_print_warn --message="The variable 'dns_over_https' should be 'true' or 'false' but isn't, please report this." diff --git a/scripts/install b/scripts/install index fa98bfc..faf9a6a 100644 --- a/scripts/install +++ b/scripts/install @@ -17,10 +17,12 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 if "$dns_over_https"; then dns_over_https="true" # no need to open the ports, as they were opened at the 'Provisioning ports' step + ynh_print_info --message="DoH and DoQ ports are already closed." else dns_over_https="false" # if dns_over_https is false, we need to close ports, # as they were opened at the 'Provisioning ports' step + ynh_print_info --message="Closing DoH and DoQ ports..." ynh_exec_warn_less yunohost firewall disallow Both "$port_dns_over_http" ynh_exec_warn_less yunohost firewall disallow UDP "$port_dns_over_quic" ynh_exec_warn_less yunohost firewall reload @@ -31,10 +33,12 @@ ynh_app_setting_set --app="$app" --key=dns_over_https --value="$dns_over_https" if "$open_port_53"; then open_port_53="true" # if open_port_53 is true, we need to open port 53 + ynh_print_info --message="Opening port 53..." ynh_exec_warn_less yunohost firewall allow Both 53 ynh_exec_warn_less yunohost firewall reload else open_port_53="false" + ynh_print_info --message="Port 53 is already closed." fi ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53"