1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

declare needs_exposed_ports according to real user need

This commit is contained in:
OniriCorpe 2024-01-01 04:09:11 +01:00
parent 4ba2351269
commit 06737daaa3
4 changed files with 16 additions and 12 deletions

View file

@ -83,11 +83,12 @@ set__dns_over_https() {
ynh_print_warn --message="The variable 'dns_over_https' should be 'true' or 'false' but isn't, please report this."
fi
if [[ $dns_over_https == 0 ]] && [[ $expose_port_53 == 0 ]]; then
# declare needs_exposed_ports according to real user need
if [ "$dns_over_https" == "true" ] && [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53" "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $dns_over_https == 0 ]]; then
elif [ "$dns_over_https" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $expose_port_53 == 0 ]]; then
elif [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53"
else
yunohost service add "$app" --description="Ads & trackers blocking DNS server"

View file

@ -109,11 +109,12 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
if [[ $dns_over_https == 0 ]] && [[ $expose_port_53 == 0 ]]; then
# declare needs_exposed_ports according to real user need
if [ "$dns_over_https" == "true" ] && [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53" "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $dns_over_https == 0 ]]; then
elif [ "$dns_over_https" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $expose_port_53 == 0 ]]; then
elif [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53"
else
yunohost service add "$app" --description="Ads & trackers blocking DNS server"

View file

@ -80,11 +80,12 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
if [[ $dns_over_https == 0 ]] && [[ $expose_port_53 == 0 ]]; then
# declare needs_exposed_ports according to real user need
if [ "$dns_over_https" == "true" ] && [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53" "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $dns_over_https == 0 ]]; then
elif [ "$dns_over_https" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $expose_port_53 == 0 ]]; then
elif [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53"
else
yunohost service add "$app" --description="Ads & trackers blocking DNS server"

View file

@ -111,11 +111,12 @@ ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
if [[ $dns_over_https == 0 ]] && [[ $expose_port_53 == 0 ]]; then
# declare needs_exposed_ports according to real user need
if [ "$dns_over_https" == "true" ] && [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53" "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $dns_over_https == 0 ]]; then
elif [ "$dns_over_https" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "$port_dns_over_http" "$port_dns_over_quic"
elif [[ $expose_port_53 == 0 ]]; then
elif [ "$expose_port_53" == "true" ]; then
yunohost service add "$app" --description="Ads & trackers blocking DNS server" --needs_exposed_ports "53"
else
yunohost service add "$app" --description="Ads & trackers blocking DNS server"