From 7342d821a320af1be428a0a1b2f6fdb30a1de235 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Sun, 12 May 2019 08:58:30 +0200 Subject: [PATCH] Fix pihole support --- .../files/etc/init.d/openmptcprouter-vps | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index b68a5c107..01d5c52b4 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -197,8 +197,12 @@ _get_vps_config() { fi fi if [ "$pihole" = "true" ]; then - uci -q set dhcp.@dnsmasq[0].server="$host_ip#53" - uci -q set dhcp.@dnsmasq[0].rebind_protection='0' + uci -q batch <<-EOF >/dev/null + set dhcp.@dnsmasq[0].server="$host_ip#53" + set dhcp.@dnsmasq[0].rebind_protection='0' + commit dhcp + EOF + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi fi if [ "$vpn" = "glorytun_udp" ]; then @@ -235,22 +239,34 @@ _get_vps_config() { fi fi if [ "$pihole" = "true" ]; then - uci -q set dhcp.@dnsmasq[0].server="$host_ip#53" - uci -q set dhcp.@dnsmasq[0].rebind_protection='0' + uci -q batch <<-EOF >/dev/null + set dhcp.@dnsmasq[0].server="$host_ip#53" + set dhcp.@dnsmasq[0].rebind_protection='0' + commit dhcp + EOF + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi fi if [ "$vpn" = "openvpn" ]; then if [ "$pihole" = "true" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.host_ip')" - uci -q set dhcp.@dnsmasq[0].server="$host_ip#53" - uci -q set dhcp.@dnsmasq[0].rebind_protection='0' + uci -q batch <<-EOF >/dev/null + set dhcp.@dnsmasq[0].server="$host_ip#53" + set dhcp.@dnsmasq[0].rebind_protection='0' + commit dhcp + EOF + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi fi if [ "$vpn" = "mlvpn" ]; then if [ "$pihole" = "true" ]; then host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.mlvpn.host_ip')" - uci -q set dhcp.@dnsmasq[0].server="$host_ip#53" - uci -q set dhcp.@dnsmasq[0].rebind_protection='0' + uci -q batch <<-EOF >/dev/null + set dhcp.@dnsmasq[0].server="$host_ip#53" + set dhcp.@dnsmasq[0].rebind_protection='0' + commit dhcp + EOF + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi fi if [ "$glorytun_change" != "0" ]; then