1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

Regex & case fix

grep & sed regexes  match commented or uncommented

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
Rob Gill 2018-05-16 07:11:23 +10:00 committed by GitHub
parent 25d0e125e5
commit a431c829cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1269,16 +1269,16 @@ check_service_active() {
# Resolved needs to remain in place for installer to download needed files
# so this change needs to be made after installation is complete, but before resarting dnsmasq/ftl
disable_resolved_stublistener() {
# Check if Systemd-resolved's DNSSTub listener is enabled and active on port 53
# Check if Systemd-resolved's DNSStubListener is enabled and active on port 53
if check_service_active "systemd-resolved"; then
# Check if DNSStubListener is enabled
if ( grep '#DNSStubListener=yes' /etc/systemd/resolved.conf &> /dev/null ); then
if ( grep -E '#?DNSStubListener=yes' /etc/systemd/resolved.conf &> /dev/null ); then
# Disable the DNSStubListener to unbind it from port 53
# Note that this breaks dns functionality on host until dnsmasq/ftl are up and running
echo -e "Disabling systemd-resolved DNSStubListener"
# Make a backup of the original /etc/systemd/resolved.conf
# (This will need to be restored on uninstallation)
sed -i.orig 's/#DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf
systemctl restart systemd-resolved
fi
fi