mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Use pihole-FTL resolver in pihole and gravity
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
b87bcc8f5f
commit
e8ec0dc701
2 changed files with 10 additions and 9 deletions
|
@ -42,6 +42,8 @@ preEventHorizon="list.preEventHorizon"
|
||||||
|
|
||||||
skipDownload="false"
|
skipDownload="false"
|
||||||
|
|
||||||
|
resolver="pihole-FTL"
|
||||||
|
|
||||||
# Source setupVars from install script
|
# Source setupVars from install script
|
||||||
setupVars="${piholeDir}/setupVars.conf"
|
setupVars="${piholeDir}/setupVars.conf"
|
||||||
if [[ -f "${setupVars}" ]];then
|
if [[ -f "${setupVars}" ]];then
|
||||||
|
@ -102,7 +104,7 @@ gravity_CheckDNSResolutionAvailable() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine error output message
|
# Determine error output message
|
||||||
if pidof dnsmasq &> /dev/null; then
|
if pidof "${resolver}" &> /dev/null; then
|
||||||
echo -e " ${CROSS} DNS resolution is currently unavailable"
|
echo -e " ${CROSS} DNS resolution is currently unavailable"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} DNS service is not running"
|
echo -e " ${CROSS} DNS service is not running"
|
||||||
|
@ -560,7 +562,7 @@ gravity_Cleanup() {
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
|
|
||||||
# Only restart DNS service if offline
|
# Only restart DNS service if offline
|
||||||
if ! pidof dnsmasq &> /dev/null; then
|
if ! pidof "${resolver}" &> /dev/null; then
|
||||||
"${PIHOLE_COMMAND}" restartdns
|
"${PIHOLE_COMMAND}" restartdns
|
||||||
dnsWasOffline=true
|
dnsWasOffline=true
|
||||||
fi
|
fi
|
||||||
|
|
13
pihole
13
pihole
|
@ -14,6 +14,8 @@ readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||||
readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
||||||
source "${colfile}"
|
source "${colfile}"
|
||||||
|
|
||||||
|
resolver="pihole-FTL"
|
||||||
|
|
||||||
# Must be root to use this tool
|
# Must be root to use this tool
|
||||||
if [[ ! $EUID -eq 0 ]];then
|
if [[ ! $EUID -eq 0 ]];then
|
||||||
if [[ -x "$(command -v sudo)" ]]; then
|
if [[ -x "$(command -v sudo)" ]]; then
|
||||||
|
@ -332,18 +334,18 @@ restartDNS() {
|
||||||
local svcOption svc str output status
|
local svcOption svc str output status
|
||||||
svcOption="${1:-}"
|
svcOption="${1:-}"
|
||||||
|
|
||||||
# Determine if we should reload or restart dnsmasq
|
# Determine if we should reload or restart restart
|
||||||
if [[ "${svcOption}" =~ "reload" ]]; then
|
if [[ "${svcOption}" =~ "reload" ]]; then
|
||||||
# Using SIGHUP will NOT re-read any *.conf files
|
# Using SIGHUP will NOT re-read any *.conf files
|
||||||
svc="killall -s SIGHUP dnsmasq"
|
svc="killall -s SIGHUP \"${resolver}\""
|
||||||
else
|
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
|
if pidof dnsmasq &> /dev/null; then
|
||||||
svcOption="restart"
|
svcOption="restart"
|
||||||
else
|
else
|
||||||
svcOption="start"
|
svcOption="start"
|
||||||
fi
|
fi
|
||||||
svc="service dnsmasq ${svcOption}"
|
svc="service \"${resolver}\" ${svcOption}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print output to Terminal, but not to Web Admin
|
# Print output to Terminal, but not to Web Admin
|
||||||
|
@ -359,9 +361,6 @@ restartDNS() {
|
||||||
[[ ! -t 1 ]] && local OVER=""
|
[[ ! -t 1 ]] && local OVER=""
|
||||||
echo -e "${OVER} ${CROSS} ${output}"
|
echo -e "${OVER} ${CROSS} ${output}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Send signal to FTL to have it re-parse the gravity files
|
|
||||||
killall -s SIGHUP pihole-FTL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
piholeEnable() {
|
piholeEnable() {
|
||||||
|
|
Loading…
Reference in a new issue