Only create resolv.conf symlink if sd-resolved.service is enabled
This way, if one wants to opt-out of resolved, installing a preset that disables the service is enough. Previously that would only disable the service, but a dangling symlink would be created.
This commit is contained in:
parent
3905512117
commit
7d7120d566
16
systemd.spec
16
systemd.spec
@ -650,13 +650,6 @@ setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/ &>/de
|
|||||||
|
|
||||||
[ $1 -eq 1 ] || exit 0
|
[ $1 -eq 1 ] || exit 0
|
||||||
|
|
||||||
# Create /etc/resolv.conf symlink.
|
|
||||||
# We would also create it using tmpfiles, but let's do this here unconditionally
|
|
||||||
# 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
|
|
||||||
ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|
||||||
|
|
||||||
# We reset the enablement of all services upon initial installation
|
# We reset the enablement of all services upon initial installation
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1118740#c23
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1118740#c23
|
||||||
# This will fix up enablement of any preset services that got installed
|
# This will fix up enablement of any preset services that got installed
|
||||||
@ -667,6 +660,15 @@ ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|||||||
systemctl preset-all &>/dev/null || :
|
systemctl preset-all &>/dev/null || :
|
||||||
systemctl --global preset-all &>/dev/null || :
|
systemctl --global preset-all &>/dev/null || :
|
||||||
|
|
||||||
|
# Create /etc/resolv.conf symlink.
|
||||||
|
# We would also create it using tmpfiles, but let's do this here
|
||||||
|
# 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
|
||||||
|
ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||||
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [ $1 -eq 0 ] ; then
|
if [ $1 -eq 0 ] ; then
|
||||||
systemctl disable --quiet \
|
systemctl disable --quiet \
|
||||||
|
Loading…
Reference in New Issue
Block a user