diff --git a/scripts/upgrade b/scripts/upgrade index e9b0afe..915c4ab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,17 @@ ynh_systemd_action --service_name="$app" --action="stop" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +if [ -n "${open_port_53:-}" ] && [ "${open_port_53:-}" == "1" ]; then + open_port_53="true" + ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" + # if open_port_53 is true, we need to open port 53 + ynh_exec_warn_less yunohost firewall allow Both 53 + ynh_exec_warn_less yunohost firewall reload +elif [ -z "${open_port_53:-}" ] || [ "${open_port_53:-}" == "0" ]; then + open_port_53="false" + ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" +fi + if [ -n "${dns_over_https:-}" ] && [ "${dns_over_https:-}" == "1" ]; then dns_over_https="true" ynh_app_setting_set --app="$app" --key=dns_over_https --value=$dns_over_https @@ -69,17 +80,6 @@ if grep -q "port_https: 443" "$install_dir/AdGuardHome.yaml" || grep -q "port_dn ynh_replace_string --match_string="port_dns_over_quic: 784" --replace_string="port_dns_over_quic: $port_dns_over_quic" --target_file="$install_dir/AdGuardHome.yaml" fi -if [ -n "${open_port_53:-}" ] && [ "${open_port_53:-}" == "1" ]; then - open_port_53="true" - ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" - # if open_port_53 is true, we need to open port 53 - ynh_exec_warn_less yunohost firewall allow Both 53 - ynh_exec_warn_less yunohost firewall reload -elif [ -z "${open_port_53:-}" ] || [ "${open_port_53:-}" == "0" ]; then - open_port_53="false" - ynh_app_setting_set --app="$app" --key=open_port_53 --value="$open_port_53" -fi - # remove setting no longer required ynh_app_setting_delete --app="$app" --key=port_adguard