From 68d7337f98b2ae8fac9b87206251598bef613f4d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Apr 2018 23:42:41 +0100 Subject: [PATCH 1/3] switch up dnsmasq detection logic Signed-off-by: Adam Warner --- automated install/basic-install.sh | 39 ++++++++++++++---------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c0d7f2ed..7fa8bf6e 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1853,23 +1853,20 @@ FTLinstall() { popd > /dev/null || { echo "Unable to return to original directory after FTL binary download."; return 1; } # Install the FTL service echo -e "${OVER} ${TICK} ${str}" - # If the --resolver flag returns True (exit code 0), then we can safely stop & disable dnsmasq - if pihole-FTL --resolver > /dev/null; then - if which dnsmasq > /dev/null; then - if check_service_active "dnsmasq";then - echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately" - stop_service dnsmasq - disable_service dnsmasq - fi - fi - - #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d` - confdir="conf-dir=/etc/dnsmasq.d" - conffile="/etc/dnsmasq.conf" - if ! grep -q "$confdir" "$conffile"; then - echo "$confdir" >> "$conffile" - fi + # dnsmasq can now be stopped and disabled + if check_service_active "dnsmasq";then + echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately" + stop_service dnsmasq + disable_service dnsmasq fi + + #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d` + confdir="conf-dir=/etc/dnsmasq.d" + conffile="/etc/dnsmasq.conf" + if ! grep -q "$confdir" "$conffile"; then + echo "$confdir" >> "$conffile" + fi + return 0 # Otherwise, else @@ -2025,6 +2022,11 @@ FTLdetect() { echo "" echo -e " ${INFO} FTL Checks..." + # if dnsmasq is running at this point, force reinstall of FTL Binary + if check_service_active "dnsmasq";then + FTLinstall "${binary}" || return 1 + fi + if FTLcheckUpdate ; then FTLinstall "${binary}" || return 1 fi @@ -2197,11 +2199,6 @@ main() { echo -e " ${INFO} Restarting services..." # Start services - # Only start and enable dnsmasq if FTL does not have the --resolver switch - if ! pihole-FTL --resolver > /dev/null; then - start_service dnsmasq - enable_service dnsmasq - fi # If the Web server was installed, if [[ "${INSTALL_WEB_SERVER}" == true ]]; then From e946a35b181fb3fb51f772b0dc14eb2b546630ca Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Apr 2018 23:50:35 +0100 Subject: [PATCH 2/3] Move dnsmasq check into FTLcheckUpdate Signed-off-by: Adam Warner --- automated install/basic-install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7fa8bf6e..57878e9a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1971,6 +1971,11 @@ FTLcheckUpdate() local remoteSha1 local localSha1 + # if dnsmasq is running at this point, force reinstall of FTL Binary + if check_service_active "dnsmasq";then + return 1 + fi + if [[ ! "${ftlBranch}" == "master" ]]; then if [[ ${ftlLoc} ]]; then # We already have a pihole-FTL binary downloaded. @@ -2022,11 +2027,6 @@ FTLdetect() { echo "" echo -e " ${INFO} FTL Checks..." - # if dnsmasq is running at this point, force reinstall of FTL Binary - if check_service_active "dnsmasq";then - FTLinstall "${binary}" || return 1 - fi - if FTLcheckUpdate ; then FTLinstall "${binary}" || return 1 fi From a07891e3e6abfe8059e642ca5807907cbf7f9744 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 30 Apr 2018 23:53:51 +0100 Subject: [PATCH 3/3] 0 is not 1!! Signed-off-by: Adam Warner --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 57878e9a..e7c5cd55 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1973,7 +1973,7 @@ FTLcheckUpdate() # if dnsmasq is running at this point, force reinstall of FTL Binary if check_service_active "dnsmasq";then - return 1 + return 0 fi if [[ ! "${ftlBranch}" == "master" ]]; then