systemd: refactor apk macros and add reload/restart support
Refactor the apk macros script so that it may be embedded by abuild into the .post-install/.pre-deinstall/.post-upgrade script of a -systemd subpackage.
Additionally, implement the post-upgrade feature of reloading or restarting services.
build on @craftyguy's earlier efforts to generate the install script(s) automatically. This brings the following features:
- embed everything into the script, no calling out to arbitrary code at package install/upgrade time. This is more reliable since changes to the script will only apply when packages are upgraded (this is how every other distro does it).
- detect services that need to be reloaded automatically
- add calls to
systemctl disable
for EVERY service during de-install, not just the ones with[Install]
sections (FIXME: is this actually correct? may have been a brain fart...) - support specifying
systemd_system_units_restart=
/systemd_user_units_restart=
in the systemd subpackage, units listed will be restarted on package upgrade (useful for stuff like apache/nginx/cups. Fedora and Debian do this too) - disallow defining custom install scripts for -systemd subpackages. This ought not be needed and makes the abuild changes simpler. It could be added if highly desirable, but maybe that can come in the future if there is demand.
- Add triggers to the systemd package to handle actually reloading/restarting marked units, as well as reloading udev, sysusers, tmpfiles, sysctl and some other stuff. This is broken because triggers are way more limited than I thought...
This is mostly untested, opening for reference/review
The abuild branch can be found here: https://gitlab.alpinelinux.org/craftyguy/abuild/-/merge_requests/2
TODO:
-
fixup everything still using the old systemd-apk-macros script, these packages won't build anymore. -
Solve the issue with triggers, we need multiple triggers on different dirs that are run in a consistent order!can't be solved without modifying apk-tools, so all trigger actions are in 1 trigger
Merge request reports
Activity
assigned to @craftyguy
Packages you maintain have been changed: @jane400
- Resolved by Clayton Craft
can various things like the binfmt-trigger potentially mark the
systemd-binfmt.service
with restart and have asystemctl reload-or-restart --marked
trigger run last?
- Resolved by Jane Rachinger
really cool! (didn't test this and didn't have a chance to look at the abuild patches)
added 7 commits
- 708a037c - main/msm-firmware-loader: drop install scripts for systemd presets
- e36de96a - systemd/networkmanager: drop install scripts for systemd presets
- 5b2c49dc - systemd/cups: drop install scripts for systemd presets
- 78831cda - systemd/gnome-keyring: drop install scripts for systemd presets
- 6efa1291 - systemd/gdm: drop install scripts for systemd presets
- 25327106 - WIP: systemd: add triggers for reloading/restarting services
- 9f99deac - WIP: abuild: switch to reworked systemd support
Toggle commit listmentioned in merge request !6056 (closed)
added 1 commit
- 9deaab1f - systemd/systemd: move udevadm into udev subpkg
added 20 commits
-
316bb284...25c8c04b - 12 commits from branch
master
- a989e6a0 - systemd: remove systemd-apk-macros.sh
- ba09221c - systemd-services: fix usb-moded-systemd package name
- 80a05c46 - systemd-services: use default_systemd from abuild
- a50407cc - WIP: systemd: add triggers for reloading/restarting services
- a60d7657 - WIP: abuild: switch to reworked systemd support
- 245b4b45 - systemd/*: use new abuild systemd helpers
- 84ff1a73 - systemd/cups: restart on upgrade
- c5e15f2f - systemd/systemd: move udevadm into udev subpkg
Toggle commit list-
316bb284...25c8c04b - 12 commits from branch