diff --git a/src/freedombone-app-pihole b/src/freedombone-app-pihole index e729df96..a3e91509 100755 --- a/src/freedombone-app-pihole +++ b/src/freedombone-app-pihole @@ -87,8 +87,8 @@ function pihole_update { write_config_param "PIHOLE_IFACE" "$PIHOLE_IFACE" fi - IPv4_address=$(get_ipv4_address) - IPv6_address=$(get_ipv6_address) + IPv4_address="$(get_ipv4_address)" + IPv6_address="$(get_ipv6_address)" setupVars=$piholeDir/setupVars.conf echo "piholeInterface=${PIHOLE_IFACE}" > ${setupVars} @@ -110,7 +110,11 @@ function pihole_update { sed -i "s|@DNS2@|${PIHOLE_DNS2}|g" /etc/dnsmasq.d/01-pihole.conf sed -i "s|interface=.*|interface=${PIHOLE_IFACE}|g" /etc/dnsmasq.d/01-pihole.conf sed -i "s|@IPv4@|${IPv4_address}|g" /etc/dnsmasq.d/01-pihole.conf - sed -i "s|@IPv6@|${IPv6_address}|g" /etc/dnsmasq.d/01-pihole.conf + if [ ${#IPv6_address} -gt 0 ]; then + sed -i "s|@IPv6@|${IPv6_address}|g" /etc/dnsmasq.d/01-pihole.conf + else + sed -i '/@IPv6@/d' /etc/dnsmasq.d/01-pihole.conf + fi sed -i "s|@HOSTNAME@|$HOSTNAME|g" /etc/dnsmasq.d/01-pihole.conf systemctl restart dnsmasq