From 0936e394d48f12fb0ee5cf19e33467c9c2697785 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Tue, 10 Nov 2015 08:12:24 -0600 Subject: [PATCH] reboot only if new IP was set --- automated install/basic-install.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d171bf8..2963dfc 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -200,7 +200,7 @@ fi setStaticIPv4() { # Append these lines to /etc/dhcpcd.conf to enable a static IP -echo "interface $ethernetDevice +echo "interface $piholeInterface static ip_address=$IPv4addr/24 static routers=$IPv4gw static domain_name_servers=$IPv4gw" | sudo tee -a $dhcpcdFile >/dev/null @@ -295,5 +295,12 @@ Your Pi will restart when you close this dialog. If you are using SSH, reconnec The install log is in /etc/phole." $r $c - -sudo reboot +# If the current IP address equals the desired address, no change is needed +if [[ $IPv4addr = "$(cat /tmp/piholeIP)" ]];then + # So just start the services + echo "sudo service dnsmasq start" + echo "sudo service lighttpd start" +else + # Restart to apply the new static IP address + echo "sudo reboot" +fi