mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge pull request #2381 from pi-hole/fix/existing_dnsmasq.conf
Improve /etc/dnsmasq.conf handling
This commit is contained in:
commit
667c5138cc
1 changed files with 11 additions and 8 deletions
|
@ -1092,7 +1092,7 @@ chooseBlocklists() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Accept a string parameter, it must be one of the default lists
|
# Accept a string parameter, it must be one of the default lists
|
||||||
# This function allow to not duplicate code in chooseBlocklists and
|
# This function allow to not duplicate code in chooseBlocklists and
|
||||||
# in installDefaultBlocklists
|
# in installDefaultBlocklists
|
||||||
appendToListsFile() {
|
appendToListsFile() {
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -1113,7 +1113,7 @@ installDefaultBlocklists() {
|
||||||
# If this file exists, we avoid overriding it.
|
# If this file exists, we avoid overriding it.
|
||||||
if [[ -f "${adlistFile}" ]]; then
|
if [[ -f "${adlistFile}" ]]; then
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
appendToListsFile StevenBlack
|
appendToListsFile StevenBlack
|
||||||
appendToListsFile MalwareDom
|
appendToListsFile MalwareDom
|
||||||
appendToListsFile Cameleon
|
appendToListsFile Cameleon
|
||||||
|
@ -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,
|
||||||
|
@ -2483,7 +2486,7 @@ main() {
|
||||||
echo -e " ${INFO} Restarting services..."
|
echo -e " ${INFO} Restarting services..."
|
||||||
# Start services
|
# Start services
|
||||||
|
|
||||||
# Enable FTL
|
# Enable FTL
|
||||||
# Ensure the service is enabled before trying to start it
|
# Ensure the service is enabled before trying to start it
|
||||||
# Fixes a problem reported on Ubuntu 18.04 where trying to start
|
# Fixes a problem reported on Ubuntu 18.04 where trying to start
|
||||||
# the service before enabling causes installer to exit
|
# the service before enabling causes installer to exit
|
||||||
|
|
Loading…
Reference in a new issue