Fix upgrade detection in %posttrans scriptlet (rhbz#2115094)
4047e4fb7b
got things very wrong.
The trick with "[ $1 -eq 1 ]" doesn't work for transaction triggers
because the argument is not provided by rpm. We need to use a state
file to propagate the information from %post to %posttrans.
This commit is contained in:
parent
3c5b26ff79
commit
bab6dfc23a
15
systemd.spec
15
systemd.spec
@ -906,6 +906,8 @@ fi
|
|||||||
[ $1 -eq 1 ] || exit 0
|
[ $1 -eq 1 ] || exit 0
|
||||||
# Initial installation
|
# Initial installation
|
||||||
|
|
||||||
|
touch %{_localstatedir}/lib/rpm-state/systemd-resolved.initial-installation
|
||||||
|
|
||||||
# Related to https://bugzilla.redhat.com/show_bug.cgi?id=1943263
|
# Related to https://bugzilla.redhat.com/show_bug.cgi?id=1943263
|
||||||
if ls /usr/lib/systemd/libsystemd-shared-24[0-8].so &>/dev/null; then
|
if ls /usr/lib/systemd/libsystemd-shared-24[0-8].so &>/dev/null; then
|
||||||
echo "Skipping presets for systemd-resolved.service, seems we are upgrading from old systemd."
|
echo "Skipping presets for systemd-resolved.service, seems we are upgrading from old systemd."
|
||||||
@ -915,14 +917,17 @@ fi
|
|||||||
%systemd_post systemd-resolved.service
|
%systemd_post systemd-resolved.service
|
||||||
|
|
||||||
%posttrans resolved
|
%posttrans resolved
|
||||||
[ $1 -eq 1 ] || exit 0
|
[ -e %{_localstatedir}/lib/rpm-state/systemd-resolved.initial-installation ] || exit 0
|
||||||
|
rm %{_localstatedir}/lib/rpm-state/systemd-resolved.initial-installation
|
||||||
# Initial installation
|
# Initial installation
|
||||||
|
|
||||||
# Create /etc/resolv.conf symlink.
|
# Create /etc/resolv.conf symlink.
|
||||||
# We would also create it using tmpfiles, but let's do this here
|
# (https://bugzilla.redhat.com/show_bug.cgi?id=1873856)
|
||||||
# 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.)
|
# We would also create it using tmpfiles, but let's do this here too
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1873856
|
# before NetworkManager gets a chance. (systemd-tmpfiles invocation
|
||||||
|
# above does not do this, because the line is marked with ! and
|
||||||
|
# tmpfiles is invoked without --boot in the scriptlet.)
|
||||||
#
|
#
|
||||||
# *Create* the symlink if nothing is present yet.
|
# *Create* the symlink if nothing is present yet.
|
||||||
# (https://bugzilla.redhat.com/show_bug.cgi?id=2032085)
|
# (https://bugzilla.redhat.com/show_bug.cgi?id=2032085)
|
||||||
|
Loading…
Reference in New Issue
Block a user