mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Add error checking for grep and correct typos
This commit is contained in:
parent
d18e064d21
commit
5060ed8970
1 changed files with 17 additions and 10 deletions
|
@ -293,19 +293,26 @@ versionCheckDNSmasq(){
|
||||||
dnsFile2="/etc/dnsmasq.conf.orig"
|
dnsFile2="/etc/dnsmasq.conf.orig"
|
||||||
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
||||||
|
|
||||||
# Check dnsmasq.conf for pihole magic
|
# Check if /etc/dnsmasq.conf exists
|
||||||
|
if [ -d "/etc/dnsmasq.conf" ]; then
|
||||||
|
# If true, Check dnsmasq.conf for pihole magic
|
||||||
if grep -q $dnsSearch $dnsFile1; then
|
if grep -q $dnsSearch $dnsFile1; then
|
||||||
# If true, Check dnsmasq.conf.orig for pihole magic
|
# If true, Check dnsmasq.conf.orig for pihole magic
|
||||||
if grep -q $dnsSearch $dnsFile1; then
|
if grep -q $dnsSearch $dnsFile2; then
|
||||||
# If true, use advanced/dnsmasq.conf.original
|
# If true, use advanced/dnsmasq.conf.original
|
||||||
$SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
$SUDO mv -f /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||||
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
||||||
else
|
else
|
||||||
# If false, mv original file back
|
# If false, mv original file back
|
||||||
$SUDO mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
$SUDO mv -f /etc/dnsmasq.conf.orig /etc/dnsmasq.conf
|
||||||
fi
|
fi
|
||||||
# If false, This is a fresh install
|
# If false, This is a fresh install
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# If false, use advanced/dnsmasq.conf.original
|
||||||
|
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
||||||
|
fi
|
||||||
|
|
||||||
$SUDO cp /etc/.pihole/advanced/01-pihole.conf /etc/dnsmasq.d/01-pihole.conf
|
$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
|
$SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.d/01-pihole.conf
|
||||||
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" /etc/dnsmasq.d/01-pihole.conf
|
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" /etc/dnsmasq.d/01-pihole.conf
|
||||||
|
|
Loading…
Reference in a new issue