Improve filetriggers to run in all required situations
This commit is contained in:
parent
56be258e41
commit
dc105f307e
30
systemd.spec
30
systemd.spec
@ -346,11 +346,37 @@ test -z "$(grep -L xml:lang %{buildroot}%{_datadir}/polkit-1/actions/org.freedes
|
||||
|
||||
#############################################################################################
|
||||
|
||||
# This will run after any package is initially installed or
|
||||
# upgraded. We care about the case where a package is initially
|
||||
# installed, because other cases are covered by the scriptlets below,
|
||||
# so sometimes we will reload needlessly.
|
||||
|
||||
%transfiletriggerin -- /usr/lib/systemd/system /etc/systemd/system
|
||||
systemctl daemon-reload &>/dev/null || :
|
||||
|
||||
# On removal, we need to run daemon-reload after any units have been
|
||||
# removed. %transfilepostun would be ideal, but it does not get
|
||||
# executed for some reason.
|
||||
# On upgrade, we need to run daemon-reload after any new unit files
|
||||
# have been installed, but before %postun scripts in packages get
|
||||
# executed. %transfiletriggerun gets the right list of files
|
||||
# but it is invoked too early (before changes happen).
|
||||
# %filetriggerpostun happens at the right time, but it fires for
|
||||
# every package.
|
||||
# To execute the reload at the right time, we create a state
|
||||
# file in %transfiletriggerun and execute the daemon-reload in
|
||||
# the first %filetriggerpostun.
|
||||
|
||||
%transfiletriggerun -- /usr/lib/systemd/system /etc/systemd/system
|
||||
systemctl daemon-reload &>/dev/null || :
|
||||
mkdir -p %{_localstatedir}/lib/rpm-state/systemd
|
||||
touch %{_localstatedir}/lib/rpm-state/systemd/needs-reload
|
||||
|
||||
%filetriggerpostun -- /usr/lib/systemd/system /etc/systemd/system
|
||||
if [ -e %{_localstatedir}/lib/rpm-state/systemd/needs-reload ]; then
|
||||
rm %{_localstatedir}/lib/rpm-state/systemd/needs-reload || :
|
||||
rmdir %{_localstatedir}/lib/rpm-state/systemd || :
|
||||
systemctl daemon-reload || :
|
||||
fi
|
||||
|
||||
%pre
|
||||
getent group cdrom >/dev/null 2>&1 || groupadd -r -g 11 cdrom >/dev/null 2>&1 || :
|
||||
@ -715,6 +741,8 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
|
||||
%{pkgdir}/boot/efi/*.stub
|
||||
%endif
|
||||
|
||||
%ghost %dir %{_localstatedir}/lib/rpm-state/systemd
|
||||
|
||||
%files libs
|
||||
%{_libdir}/security/pam_systemd.so
|
||||
%{_libdir}/libnss_myhostname.so.2
|
||||
|
Loading…
Reference in New Issue
Block a user