From: Zbigniew Jędrzejewski-Szmek Date: Fri, 5 Feb 2021 16:03:43 +0000 (+0100) Subject: rpm: order sysctl/sysusers/tmpfiles execution before package scriptlets X-Git-Tag: v248-rc1~115^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd621954ed643c6ee0d869132293e26056a48826;p=thirdparty%2Fsystemd.git rpm: order sysctl/sysusers/tmpfiles execution before package scriptlets P>1000000 is *before* "normal" scriptlets, P<1000000 is *after*. I think it makes sense to do stuff like execution of sysctl/sysusers/tmpfiles configuration before package scriptlets. I think that was the intent, but a single digit got dropped ;( Also, let's reorder the scriptlets in the file to match execution order, to make it easier to see what is going on. Most of those may happen in any order, but there are some exceptions: tmpfiles should be after sysusers, udevadm --reload should be after hwdb. --- diff --git a/src/rpm/triggers.systemd.in b/src/rpm/triggers.systemd.in index 1e925cf9740..37f62cb1b76 100644 --- a/src/rpm/triggers.systemd.in +++ b/src/rpm/triggers.systemd.in @@ -50,74 +50,74 @@ if posix.access("/run/systemd/system") then end end -%transfiletriggerin -P 100500 -p -- @tmpfilesdir@ --- This script will process files installed in @tmpfilesdir@ to create --- tmpfiles automatically. The priority is set such that it will run --- after the sysusers file trigger, but before any other triggers. +%transfiletriggerin -P 1000700 udev -p -- @udevhwdbdir@ +-- This script will automatically invoke hwdb update if files have been +-- installed or updated in @udevhwdbdir@. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("%{_bindir}/systemd-tmpfiles", "--create")) + assert(posix.exec("%{_bindir}/systemd-hwdb", "update")) elseif pid > 0 then posix.wait(pid) end end -%transfiletriggerin udev -p -- @udevhwdbdir@ --- This script will automatically invoke hwdb update if files have been --- installed or updated in @udevhwdbdir@. +%transfiletriggerin -P 1000700 -p -- @catalogdir@ +-- This script will automatically invoke journal catalog update if files +-- have been installed or updated in @catalogdir@. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("%{_bindir}/systemd-hwdb", "update")) + assert(posix.exec("%{_bindir}/journalctl", "--update-catalog")) elseif pid > 0 then posix.wait(pid) end end -%transfiletriggerin -p -- @catalogdir@ --- This script will automatically invoke journal catalog update if files --- have been installed or updated in @catalogdir@. +%transfiletriggerin -P 1000700 -p -- @binfmtdir@ +-- This script will automatically apply binfmt rules if files have been +-- installed or updated in @binfmtdir@. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("%{_bindir}/journalctl", "--update-catalog")) + assert(posix.exec("@rootlibexecdir@/systemd-binfmt")) elseif pid > 0 then posix.wait(pid) end end -%transfiletriggerin udev -p -- @udevrulesdir@ --- This script will automatically update udev with new rules if files --- have been installed or updated in @udevrulesdir@. +%transfiletriggerin -P 1000600 -p -- @tmpfilesdir@ +-- This script will process files installed in @tmpfilesdir@ to create +-- tmpfiles automatically. The priority is set such that it will run +-- after the sysusers file trigger, but before any other triggers. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("%{_bindir}/udevadm", "control", "--reload")) + assert(posix.exec("%{_bindir}/systemd-tmpfiles", "--create")) elseif pid > 0 then posix.wait(pid) end end -%transfiletriggerin -p -- @sysctldir@ --- This script will automatically apply sysctl rules if files have been --- installed or updated in @sysctldir@. +%transfiletriggerin -P 1000600 udev -p -- @udevrulesdir@ +-- This script will automatically update udev with new rules if files +-- have been installed or updated in @udevrulesdir@. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("@rootlibexecdir@/systemd-sysctl")) + assert(posix.exec("%{_bindir}/udevadm", "control", "--reload")) elseif pid > 0 then posix.wait(pid) end end -%transfiletriggerin -p -- @binfmtdir@ --- This script will automatically apply binfmt rules if files have been --- installed or updated in @binfmtdir@. +%transfiletriggerin -P 1000500 -p -- @sysctldir@ +-- This script will automatically apply sysctl rules if files have been +-- installed or updated in @sysctldir@. if posix.access("/run/systemd/system") then pid = posix.fork() if pid == 0 then - assert(posix.exec("@rootlibexecdir@/systemd-binfmt")) + assert(posix.exec("@rootlibexecdir@/systemd-sysctl")) elseif pid > 0 then posix.wait(pid) end diff --git a/src/rpm/triggers.systemd.sh.in b/src/rpm/triggers.systemd.sh.in index 641afd9ef7b..c1af5f43d3b 100644 --- a/src/rpm/triggers.systemd.sh.in +++ b/src/rpm/triggers.systemd.sh.in @@ -28,7 +28,7 @@ if test -d "/run/systemd/system"; then %{_bindir}/systemctl daemon-reload || : fi -%transfiletriggerin -P 100700 -- @sysusersdir@ +%transfiletriggerin -P 1000700 -- @sysusersdir@ # This script will process files installed in @sysusersdir@ to create # specified users automatically. The priority is set such that it # will run before the tmpfiles file trigger. @@ -36,47 +36,47 @@ if test -d "/run/systemd/system"; then %{_bindir}/systemd-sysusers || : fi -%transfiletriggerin -P 100500 -- @tmpfilesdir@ -# This script will process files installed in @tmpfilesdir@ to create -# tmpfiles automatically. The priority is set such that it will run -# after the sysusers file trigger, but before any other triggers. -if test -d "/run/systemd/system"; then - %{_bindir}/systemd-tmpfiles --create || : -fi - -%transfiletriggerin udev -- @udevhwdbdir@ +%transfiletriggerin -P 1000700 udev -- @udevhwdbdir@ # This script will automatically invoke hwdb update if files have been # installed or updated in @udevhwdbdir@. if test -d "/run/systemd/system"; then %{_bindir}/systemd-hwdb update || : fi -%transfiletriggerin -- @catalogdir@ +%transfiletriggerin -P 1000700 -- @catalogdir@ # This script will automatically invoke journal catalog update if files # have been installed or updated in @catalogdir@. if test -d "/run/systemd/system"; then %{_bindir}/journalctl --update-catalog || : fi -%transfiletriggerin udev -- @udevrulesdir@ +%transfiletriggerin -P 1000700 -- @binfmtdir@ +# This script will automatically apply binfmt rules if files have been +# installed or updated in @binfmtdir@. +if test -d "/run/systemd/system"; then + # systemd-binfmt might fail if binfmt_misc kernel module is not loaded + # during install + @rootlibexecdir@/systemd-binfmt || : +fi + +%transfiletriggerin -P 1000600 -- @tmpfilesdir@ +# This script will process files installed in @tmpfilesdir@ to create +# tmpfiles automatically. The priority is set such that it will run +# after the sysusers file trigger, but before any other triggers. +if test -d "/run/systemd/system"; then + %{_bindir}/systemd-tmpfiles --create || : +fi + +%transfiletriggerin -P 1000600 udev -- @udevrulesdir@ # This script will automatically update udev with new rules if files # have been installed or updated in @udevrulesdir@. if test -e /run/udev/control; then %{_bindir}/udevadm control --reload || : fi -%transfiletriggerin -- @sysctldir@ +%transfiletriggerin -P 1000500 -- @sysctldir@ # This script will automatically apply sysctl rules if files have been # installed or updated in @sysctldir@. if test -d "/run/systemd/system"; then @rootlibexecdir@/systemd-sysctl || : fi - -%transfiletriggerin -- @binfmtdir@ -# This script will automatically apply binfmt rules if files have been -# installed or updated in @binfmtdir@. -if test -d "/run/systemd/system"; then - # systemd-binfmt might fail if binfmt_misc kernel module is not loaded - # during install - @rootlibexecdir@/systemd-binfmt || : -fi