From e8ec0dc701d00a2d8a8d5f5a0da5329a4748b059 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 25 Feb 2018 09:34:04 +0100 Subject: [PATCH] Use pihole-FTL resolver in pihole and gravity Signed-off-by: DL6ER --- gravity.sh | 6 ++++-- pihole | 13 ++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gravity.sh b/gravity.sh index ce2734fc..22c78201 100755 --- a/gravity.sh +++ b/gravity.sh @@ -42,6 +42,8 @@ preEventHorizon="list.preEventHorizon" skipDownload="false" +resolver="pihole-FTL" + # Source setupVars from install script setupVars="${piholeDir}/setupVars.conf" if [[ -f "${setupVars}" ]];then @@ -102,7 +104,7 @@ gravity_CheckDNSResolutionAvailable() { fi # Determine error output message - if pidof dnsmasq &> /dev/null; then + if pidof "${resolver}" &> /dev/null; then echo -e " ${CROSS} DNS resolution is currently unavailable" else echo -e " ${CROSS} DNS service is not running" @@ -560,7 +562,7 @@ gravity_Cleanup() { echo -e "${OVER} ${TICK} ${str}" # Only restart DNS service if offline - if ! pidof dnsmasq &> /dev/null; then + if ! pidof "${resolver}" &> /dev/null; then "${PIHOLE_COMMAND}" restartdns dnsWasOffline=true fi diff --git a/pihole b/pihole index 4421cb87..54701027 100755 --- a/pihole +++ b/pihole @@ -14,6 +14,8 @@ readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE" source "${colfile}" +resolver="pihole-FTL" + # Must be root to use this tool if [[ ! $EUID -eq 0 ]];then if [[ -x "$(command -v sudo)" ]]; then @@ -332,18 +334,18 @@ restartDNS() { local svcOption svc str output status svcOption="${1:-}" - # Determine if we should reload or restart dnsmasq + # Determine if we should reload or restart restart if [[ "${svcOption}" =~ "reload" ]]; then # Using SIGHUP will NOT re-read any *.conf files - svc="killall -s SIGHUP dnsmasq" + svc="killall -s SIGHUP \"${resolver}\"" else - # Get PID of dnsmasq to determine if it needs to start or restart + # Get PID of resolver to determine if it needs to start or restart if pidof dnsmasq &> /dev/null; then svcOption="restart" else svcOption="start" fi - svc="service dnsmasq ${svcOption}" + svc="service \"${resolver}\" ${svcOption}" fi # Print output to Terminal, but not to Web Admin @@ -359,9 +361,6 @@ restartDNS() { [[ ! -t 1 ]] && local OVER="" echo -e "${OVER} ${CROSS} ${output}" fi - - # Send signal to FTL to have it re-parse the gravity files - killall -s SIGHUP pihole-FTL } piholeEnable() {