From e2e8b733a85a1f290269993823db138583e65265 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 18 Mar 2018 00:13:10 +0000 Subject: [PATCH] tidy up function Signed-off-by: Adam Warner --- automated install/basic-install.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ddebe6fa..2574b4a3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1177,17 +1177,12 @@ check_service_active() { # If systemctl exists, if command -v systemctl &> /dev/null; then # use that to check the status of the service - systemctl is-enabled "${1}" > /dev/null - return $? + systemctl is-enabled "${1}" > /dev/null # Otherwise, else # fall back to service command - if service "${1}" status | grep "Active: active" > /dev/null; then - return 0 - else - return 1 - fi - fi + service "${1}" status > /dev/null + fi } update_package_cache() { @@ -1824,12 +1819,12 @@ FTLinstall() { 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 2>/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 fi #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`