66
77# The contents of this are an example to be copied into systemd.spec.
88#
9- # Minimum rpm version supported: 4.13 .0
9+ # Minimum rpm version supported: 4.14 .0
1010
1111%transfiletriggerin -P 900900 -p < lua> -- @systemunitdir@ /etc/systemd/system
1212-- This script will run after any package is initially installed or
1313-- upgraded. We care about the case where a package is initially
1414-- installed, because other cases are covered by the *un scriptlets,
1515-- so sometimes we will reload needlessly.
16-
1716if posix.access("/run/systemd/system") then
1817 pid = posix.fork()
1918 if pid == 0 then
@@ -23,31 +22,13 @@ if posix.access("/run/systemd/system") then
2322 end
2423end
2524
26- %transfiletriggerun -p < lua> -- @systemunitdir@ /etc/systemd/system
25+ %transfiletriggerpostun -P 1000100 -p < lua> -- @systemunitdir@ /etc/systemd/system
2726-- On removal, we need to run daemon-reload after any units have been
28- -- removed. %transfiletriggerpostun would be ideal, but it does not get
29- -- executed for some reason.
27+ -- removed.
3028-- On upgrade, we need to run daemon-reload after any new unit files
3129-- have been installed, but before %postun scripts in packages get
32- -- executed. %transfiletriggerun gets the right list of files
33- -- but it is invoked too early (before changes happen).
34- -- %filetriggerpostun happens at the right time, but it fires for
35- -- every package.
36- -- To execute the reload at the right time, we create a state
37- -- file in %transfiletriggerun and execute the daemon-reload in
38- -- the first %filetriggerpostun .
39-
30+ -- executed.
4031if posix.access("/run/systemd/system") then
41- posix.mkdir("%{_localstatedir }/lib")
42- posix.mkdir("%{_localstatedir }/lib/rpm-state")
43- posix.mkdir("%{_localstatedir }/lib/rpm-state/systemd")
44- io.open("%{_localstatedir }/lib/rpm-state/systemd/needs-reload", "w")
45- end
46-
47- %filetriggerpostun -P 1000100 -p < lua> -- @systemunitdir@ /etc/systemd/system
48- if posix.access("%{_localstatedir }/lib/rpm-state/systemd/needs-reload") then
49- posix.unlink("%{_localstatedir }/lib/rpm-state/systemd/needs-reload")
50- posix.rmdir("%{_localstatedir }/lib/rpm-state/systemd")
5132 pid = posix.fork()
5233 if pid == 0 then
5334 assert(posix.exec("%{_bindir }/systemctl", "daemon-reload"))
0 commit comments