tidy up function

Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
Adam Warner 2018-03-18 00:13:10 +00:00
parent f18bf35b20
commit e2e8b733a8
No known key found for this signature in database
GPG key ID: F5410858022DA5EB

View file

@ -1177,17 +1177,12 @@ check_service_active() {
# If systemctl exists, # If systemctl exists,
if command -v systemctl &> /dev/null; then if command -v systemctl &> /dev/null; then
# use that to check the status of the service # use that to check the status of the service
systemctl is-enabled "${1}" > /dev/null systemctl is-enabled "${1}" > /dev/null
return $?
# Otherwise, # Otherwise,
else else
# fall back to service command # fall back to service command
if service "${1}" status | grep "Active: active" > /dev/null; then service "${1}" status > /dev/null
return 0 fi
else
return 1
fi
fi
} }
update_package_cache() { update_package_cache() {
@ -1824,12 +1819,12 @@ FTLinstall() {
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
# If the --resolver flag returns True (exit code 0), then we can safely stop & disable dnsmasq # If the --resolver flag returns True (exit code 0), then we can safely stop & disable dnsmasq
if pihole-FTL --resolver > /dev/null; then 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 if check_service_active "dnsmasq";then
echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately" echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately"
stop_service dnsmasq stop_service dnsmasq
disable_service dnsmasq disable_service dnsmasq
fi fi
fi fi
#ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d` #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d`