From fa59ad35a9c2b983f7b7a1e7dc89d350ef142fe6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 8 Feb 2020 18:27:44 +0100 Subject: [PATCH] [conf] Automatically disable/stop systemd-resolved that conflicts with dnsmasq on fresh setups ... --- data/hooks/conf_regen/43-dnsmasq | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/data/hooks/conf_regen/43-dnsmasq b/data/hooks/conf_regen/43-dnsmasq index 8cddec1be..75d74b09c 100755 --- a/data/hooks/conf_regen/43-dnsmasq +++ b/data/hooks/conf_regen/43-dnsmasq @@ -69,8 +69,16 @@ do_post_regen() { short_hostname=$(hostname -s) grep -q "127.0.0.1.*$short_hostname" /etc/hosts || echo -e "\n127.0.0.1\t$short_hostname" >>/etc/hosts - [[ -z "$regen_conf_files" ]] \ - || service dnsmasq restart + [[ -n "$regen_conf_files" ]] || return + + # Remove / disable services likely to conflict with dnsmasq + for SERVICE in systemd-resolved bind9 + do + systemctl is-enabled $SERVICE &>/dev/null && systemctl disable $SERVICE 2>/dev/null + systemctl is-active $SERVICE &>/dev/null && systemctl stop $SERVICE + done + + systemctl restart dnsmasq } FORCE=${2:-0}