Create /etc/resolv.conf symlink if nothing is present yet
(cherry picked from commit 7f4e198603
)
This commit is contained in:
parent
df4de9640e
commit
ea7cbea4df
39
systemd.spec
39
systemd.spec
|
@ -370,6 +370,8 @@ devices.
|
|||
|
||||
%package resolved
|
||||
Summary: Network Name Resolution manager
|
||||
Requires(post): %{name}
|
||||
Requires(post): grep
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: %{name} < 249~~
|
||||
|
||||
|
@ -918,13 +920,13 @@ 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 [ -L /etc/resolv.conf ] && \
|
||||
realpath /etc/resolv.conf | grep ^/run/systemd/resolve/; then
|
||||
rm -f /etc/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
|
||||
ln -fsv ../run/NetworkManager/resolv.conf /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -945,17 +947,25 @@ fi
|
|||
# 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 systemd is not running, don't overwrite the symlink because that
|
||||
# will immediately break DNS resolution, since systemd-resolved is
|
||||
# also not running (https://bugzilla.redhat.com/show_bug.cgi?id=1891847).
|
||||
# *Create* the symlink if nothing is present yet.
|
||||
# (https://bugzilla.redhat.com/show_bug.cgi?id=2032085)
|
||||
#
|
||||
# *Override* the symlink if systemd is running. Don't do it if systemd
|
||||
# is not running, because that will immediately break DNS resolution,
|
||||
# since systemd-resolved is also not running
|
||||
# (https://bugzilla.redhat.com/show_bug.cgi?id=1891847).
|
||||
#
|
||||
# Also don't create the symlink to the stub when the stub is disabled (#1891847 again).
|
||||
if test -d /run/systemd/system/ &&
|
||||
systemctl -q is-enabled systemd-resolved.service &>/dev/null &&
|
||||
! mountpoint /etc/resolv.conf &>/dev/null &&
|
||||
! systemd-analyze cat-config systemd/resolved.conf 2>/dev/null | \
|
||||
grep -qE '^DNSStubListener\s*=\s*([nN][oO]?|[fF]|[fF][aA][lL][sS][eE]|0|[oO][fF][fF])$'; then
|
||||
ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
if systemctl -q is-enabled systemd-resolved.service &>/dev/null &&
|
||||
! systemd-analyze cat-config systemd/resolved.conf 2>/dev/null |
|
||||
grep -iqE '^DNSStubListener\s*=\s*(no?|false|0|off)\s*$'; then
|
||||
|
||||
if ! test -e /etc/resolv.conf; then
|
||||
ln -sv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
elif test -d /run/systemd/system/ &&
|
||||
! mountpoint /etc/resolv.conf &>/dev/null; then
|
||||
ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
%global _docdir_fmt %{name}
|
||||
|
@ -1011,6 +1021,9 @@ fi
|
|||
%files standalone-sysusers -f .file-list-standalone-sysusers
|
||||
|
||||
%changelog
|
||||
* Tue Jan 11 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 249.7-2
|
||||
- Create /etc/resolv.conf symlink if nothing is present yet (#2032085)
|
||||
|
||||
* Mon Nov 15 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 249.7-2
|
||||
- Supress errors from update-helper when selinux is enabled (see #2023332)
|
||||
|
||||
|
|
Loading…
Reference in New Issue