diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 5d77b5f11..8a2195681 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -454,9 +454,9 @@ _get_pihole() { if [ "$vpn" = "glorytun_tcp" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.tcp.host_ip')" - if [ "$pihole" = "true" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server)" != "$host_ip#53" ]; then + if [ "$pihole" = "true" ] && [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep $host_ip)" ]; then + uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.2')" uci -q batch <<-EOF >/dev/null - delete dhcp.@dnsmasq[0].server add_list dhcp.@dnsmasq[0].server="$host_ip#53" set dhcp.@dnsmasq[0].rebind_protection='0' commit dhcp @@ -467,9 +467,9 @@ _get_pihole() { fi if [ "$vpn" = "glorytun_udp" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.host_ip')" - if [ "$pihole" = "true" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server)" != "$host_ip#53" ]; then + if [ "$pihole" = "true" ] && [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep $host_ip)" ]; then + uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.2')" uci -q batch <<-EOF >/dev/null - delete dhcp.@dnsmasq[0].server add_list dhcp.@dnsmasq[0].server="$host_ip#53" set dhcp.@dnsmasq[0].rebind_protection='0' commit dhcp @@ -480,9 +480,9 @@ _get_pihole() { fi if [ "$vpn" = "openvpn" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.host_ip')" - if [ "$pihole" = "true" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server)" != "$host_ip#53" ]; then + if [ "$pihole" = "true" ] && [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep $host_ip)" ]; then + uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.2')" uci -q batch <<-EOF >/dev/null - delete dhcp.@dnsmasq[0].server add_list dhcp.@dnsmasq[0].server="$host_ip#53" set dhcp.@dnsmasq[0].rebind_protection='0' commit dhcp @@ -493,9 +493,9 @@ _get_pihole() { fi if [ "$vpn" = "mlvpn" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.mlvpn.host_ip')" - if [ "$pihole" = "true" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server)" != "$host_ip#53" ]; then + if [ "$pihole" = "true" ] && [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep $host_ip)" ]; then + uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.2')" uci -q batch <<-EOF >/dev/null - delete dhcp.@dnsmasq[0].server add_list dhcp.@dnsmasq[0].server="$host_ip#53" set dhcp.@dnsmasq[0].rebind_protection='0' commit dhcp @@ -506,9 +506,9 @@ _get_pihole() { fi if [ "$vpn" = "dsvpn" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.host_ip')" - if [ "$pihole" = "true" ] && [ "$(uci -q get dhcp.@dnsmasq[0].server)" != "$host_ip#53" ]; then + if [ "$pihole" = "true" ] && [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep $host_ip)" ]; then + uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.2')" uci -q batch <<-EOF >/dev/null - delete dhcp.@dnsmasq[0].server add_list dhcp.@dnsmasq[0].server="$host_ip#53" set dhcp.@dnsmasq[0].rebind_protection='0' commit dhcp