Do not touch resolv.conf if it is a mountpoint

https://bugzilla.redhat.com/show_bug.cgi?id=1885101
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-10-08 11:52:07 +02:00
parent 14b2fafb36
commit 96b7895b99
1 changed files with 3 additions and 1 deletions

View File

@ -667,7 +667,8 @@ systemctl --global preset-all &>/dev/null || :
# too before NetworkManager gets a chance. (systemd-tmpfiles invocation above
# does not do this, because it's marked with ! and we don't specify --boot.)
# https://bugzilla.redhat.com/show_bug.cgi?id=1873856
if systemctl -q is-enabled systemd-resolved.service &>/dev/null; then
if systemctl -q is-enabled systemd-resolved.service &>/dev/null &&
! mountpoint /etc/resolv.conf &>/dev/null; then
ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
fi
@ -691,6 +692,7 @@ systemctl --no-reload preset systemd-resolved.service &>/dev/null || :
if systemctl -q is-enabled systemd-resolved.service &>/dev/null; then
systemctl -q is-enabled NetworkManager.service 2>/dev/null && \
! test -L /etc/resolv.conf 2>/dev/null && \
! mountpoint /etc/resolv.conf &>/dev/null && \
grep -q 'Generated by NetworkManager' /etc/resolv.conf 2>/dev/null && \
echo -e '/etc/resolv.conf was generated by NetworkManager.\nRemoving it to let systemd-resolved manage this file.' && \
mv -v /etc/resolv.conf /etc/resolv.conf.orig-with-nm && \