From 27cc5e08c2c1880dba66ce46cabebfd17cac8fde Mon Sep 17 00:00:00 2001 From: Petr Menšík Date: Nov 14 2021 09:38:52 +0000 Subject: Switch to NM resolver on systemd-resolved uninstall If /etc/resolv.conf pointed to systemd-resolved stub configuration, it is obvious it would stop working. Compensate it by deleting the link, it would be created again on installation. Try to pass ownership to NM, which also provides similar file. Keep it missing otherwise, might be created by unknown tool on reboot. Signed-off-by: Petr Menšík --- diff --git a/systemd.spec b/systemd.spec index 49e0b6f..618e0c9 100644 --- a/systemd.spec +++ b/systemd.spec @@ -920,6 +920,14 @@ if [ $1 -eq 0 ] ; then systemctl disable --quiet \ systemd-resolved.service \ >/dev/null || : + if [ -L %{_sysconfdir}/resolv.conf ] && \ + realpath %{_sysconfdir}/resolv.conf | grep ^/run/systemd/resolve/; then + rm -f %{_sysconfdir}/resolv.conf # no longer useful + # if network manager is enabled, move to it instead + [ -f /run/NetworkManager/resolv.conf ] && \ + systemctl -q is-enabled NetworkManager.service &>/dev/null && \ + ln -fsv ../run/NetworkManager/resolv.conf %{_sysconfdir}/resolv.conf + fi fi %post resolved