From 8c0f860601ac0e906d7871690e7cec49c8448275 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 16 Oct 2016 17:16:59 +0100 Subject: [PATCH 1/3] Use systemctl/service calls instead of killall to restart/reload dnsmasq --- advanced/Scripts/blacklist.sh | 18 +++++++++++++----- advanced/Scripts/whitelist.sh | 18 +++++++++++++----- gravity.sh | 21 ++++++++++++++------- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index feeca9da..8bcf22bf 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -168,14 +168,22 @@ Reload() { echo ":::" echo -n "::: Refresh lists in dnsmasq..." - dnsmasqPid=$(pidof dnsmasq) + dnsmasqPid=$(pidof dnsmasq) if [[ ${dnsmasqPid} ]]; then - # service already running - reload config - killall -s HUP dnsmasq + # service already running - reload config + if [ -x "$(command -v systemctl)" ]; then + systemctl restart dnsmasq + else + service dnsmasq restart + fi else - # service not running, start it up - service dnsmasq start + # service not running, start it up + if [ -x "$(command -v systemctl)" ]; then + systemctl start dnsmasq + else + service dnsmasq start + fi fi echo " done!" } diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index d6a09b35..f715a2fd 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -185,14 +185,22 @@ Reload() { # Reload hosts file echo ":::" echo -n "::: Refresh lists in dnsmasq..." - dnsmasqPid=$(pidof dnsmasq) + dnsmasqPid=$(pidof dnsmasq) if [[ ${dnsmasqPid} ]]; then - # service already running - reload config - killall -s HUP dnsmasq + # service already running - reload config + if [ -x "$(command -v systemctl)" ]; then + systemctl restart dnsmasq + else + service dnsmasq restart + fi else - # service not running, start it up - service dnsmasq start + # service not running, start it up + if [ -x "$(command -v systemctl)" ]; then + systemctl start dnsmasq + else + service dnsmasq start + fi fi echo " done!" } diff --git a/gravity.sh b/gravity.sh index 5f0606b4..46be515c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -310,18 +310,25 @@ gravity_reload() { adList=${adList//\//\\\/} #Now replace the line in dnsmasq file sed -i "s/^addn-hosts.*/addn-hosts=$adList/" /etc/dnsmasq.d/01-pihole.conf - dnsmasqPid=$(pidof dnsmasq) + find "$piholeDir" -type f -exec chmod 666 {} \; - find "$piholeDir" -type f -exec chmod 666 {} \; + dnsmasqPid=$(pidof dnsmasq) if [[ ${dnsmasqPid} ]]; then - # service already running - reload config - killall -s HUP dnsmasq + # service already running - reload config + if [ -x "$(command -v systemctl)" ]; then + systemctl restart dnsmasq + else + service dnsmasq restart + fi else - # service not running, start it up - service dnsmasq start + # service not running, start it up + if [ -x "$(command -v systemctl)" ]; then + systemctl start dnsmasq + else + service dnsmasq start + fi fi - echo " done!" } From 42c93917ef112378e78f4bbd1a69ea25ebc923d3 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 16 Oct 2016 17:19:44 +0100 Subject: [PATCH 2/3] bug I forgot to fix before piholeUpdate was merged to development --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 26f66e0a..361fb089 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -895,11 +895,11 @@ update_dialogs(){ if [[ $? = 0 ]];then case ${UpdateCmd} in - Update) + ${opt1a}) echo "::: Updating existing install" useUpdateVars=true ;; - Install) + ${opt2a}) echo "::: Running complete install script" useUpdateVars=false ;; From 5792fc0befda7117667b9aab9c34cafa4e59e3d5 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sun, 16 Oct 2016 17:23:26 +0100 Subject: [PATCH 3/3] change wording depending on choice --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 361fb089..0d6ea97b 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -896,11 +896,11 @@ update_dialogs(){ if [[ $? = 0 ]];then case ${UpdateCmd} in ${opt1a}) - echo "::: Updating existing install" + echo "::: $opt1a option selected." useUpdateVars=true ;; ${opt2a}) - echo "::: Running complete install script" + echo "::: $opt2a option selected" useUpdateVars=false ;; esac