Merge pull request #2381 from pi-hole/fix/existing_dnsmasq.conf

Improve /etc/dnsmasq.conf handling
This commit is contained in:
Mark Drobnak 2018-08-25 18:55:12 -05:00 committed by GitHub
commit 667c5138cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2109,12 +2109,15 @@ FTLinstall() {
fi fi
fi fi
#ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d` # Backup existing /etc/dnsmasq.conf if present and ensure that
confdir="conf-dir=/etc/dnsmasq.d" # /etc/dnsmasq.conf contains only "conf-dir=/etc/dnsmasq.d"
conffile="/etc/dnsmasq.conf" local conffile="/etc/dnsmasq.conf"
if ! grep -q "$confdir" "$conffile"; then if [[ -f "${conffile}" ]]; then
echo "$confdir" >> "$conffile" echo " ${INFO} Backing up ${conffile} to ${conffile}.old"
mv "${conffile}" "${conffile}.old"
fi fi
# Create /etc/dnsmasq.conf
echo "conf-dir=/etc/dnsmasq.d" > "${conffile}"
return 0 return 0
# Otherwise, # Otherwise,