From 9f5fc87ef45921093661452bf42a47fa11993ffa Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Nov 13 2025 17:50:33 +0000 Subject: Systemd: reword, clarify, clean up unit / dropin install locations - Just say that systemd unit files must be shipped in either %{_unitdir} or %{_userunitdir}, with them being the appropriate place for system services and user session services, respectively. - Drop what the macros expand to - information like that tends to get outdated (though admittedly, that is unlikely in this case). - Also drop "needed early in the boot process". This is just weird and out of context in this section, and doesn't explain anything unless you happen know how initramfs are constructed by dracut. Fixes: https://pagure.io/packaging-committee/issue/1467 --- diff --git a/guidelines/modules/ROOT/pages/Systemd.adoc b/guidelines/modules/ROOT/pages/Systemd.adoc index fb2cf08..8a59dc0 100644 --- a/guidelines/modules/ROOT/pages/Systemd.adoc +++ b/guidelines/modules/ROOT/pages/Systemd.adoc @@ -628,30 +628,20 @@ https://www.freedesktop.org/software/systemd/man/systemd.exec.html[systemd.exec( [#packaging_filesystem] === Filesystem locations -Packages with systemd unit files *must* put them into `+%{_unitdir}+` -or `+%{_userunitdir}+`. -`+%{_unitdir}+` evaluates to `+/usr/lib/systemd/system+` on all Fedora systems -and `+%{_userunitdir}%+` evaluates to `+/usr/lib/systemd/user+`. -Unit files are architecture independent -(hence, not `+%{_lib}+`) -and needed early in the boot process. -Most systemd service files should use `+%{_unitdir}+`. -However, if the service runs as part of a user session -(e.g. pipewire services, gpg-agent, tracker, etc), -use `+%{_userunitdir}+` instead. - -Please note that in order for the `+%{_unitdir}+` or `+%{_userunitdir}+` macro to exist, -your package must have: +systemd unit files *must* be shipped in either `+%{_unitdir}+` or `+%{_userunitdir}+`, +for system services and user session services, respectively. +Unit drop-ins *must* be shipped in appropriate sub-directories of these two directories. +Unit files and drop-ins *must* be world-readable (i.e. mode `+0644+`) +and *must not* be marked as `%config` or `%config(noreplace)`. + +The `+%{_unitdir}+` and `+%{_userunitdir}+` macros +are defined in the `+systemd-rpm-macros+` package, +so something like this is required for them to be available: .... BuildRequires: systemd-rpm-macros .... -[#packaging_files_section] -=== %files section - -Systemd unit `+.service+` files must not be marked as `+%config+` files. - [#packaging_unit_files_in_scriptlets] === Unit files in spec file scriptlets