[conf] Automatically disable/stop systemd-resolved that conflicts with dnsmasq on fresh setups ...

This commit is contained in:
Alexandre Aubin 2020-02-08 18:27:44 +01:00
parent fa5130a7fc
commit fa59ad35a9

View file

@ -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}