mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
versionCheckDNSmasq() fixups
versionCheckDNSmasq() fixups per dschaper's suggestions.
This commit is contained in:
parent
a21948d2c6
commit
ac373545d0
1 changed files with 14 additions and 4 deletions
|
@ -282,12 +282,22 @@ setDNS(){
|
|||
|
||||
versionCheckDNSmasq(){
|
||||
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
|
||||
dnsFile="/etc/dnsmasq.conf"
|
||||
dnsFile1="/etc/dnsmasq.conf"
|
||||
dnsFile2="/etc/dnsmasq.conf"
|
||||
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
||||
|
||||
if grep -q $dnsSearch $dnsFile; then
|
||||
$SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
||||
# Check dnsmasq.conf for pihole magic
|
||||
if grep -q $dnsSearch $dnsFile1; then
|
||||
# If true, Check dnsmasq.conf.orig for pihole magic
|
||||
if grep -q $dnsSearch $dnsFile1; then
|
||||
# If true, use advanced/dnsmasq.conf.original
|
||||
$SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
||||
else
|
||||
# If false, mv original file back
|
||||
$SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||
fi
|
||||
# If false, This is a fresh install
|
||||
fi
|
||||
$SUDO cp /etc/.pihole/advanced/01-pihole.conf /etc/dnsmasq.d/01-pihole.conf
|
||||
$SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.d/01-pihole.conf
|
||||
|
|
Loading…
Reference in a new issue