#1085 Mention _userunitdir in the systemd packaging guidelines
Merged 2 years ago by ngompa. Opened 2 years ago by troycurtisjr.
troycurtisjr/packaging-committee systemd-package-user-updates  into  master

@@ -340,9 +340,9 @@ 

  

  === Filesystem locations

  

- Packages with systemd unit files *must* put them into `+%{_unitdir}+`. `+%{_unitdir}+` evaluates to /usr/lib/systemd/system on all Fedora systems (F-15+). Unit files are architecture independent (hence, not `+%{_lib}+`) and needed early in the boot process.

+ Packages with systemd unit files *must* put them into `+%{_unitdir}+` or `+%{_userunitdir}+`. `+%{_unitdir}+` evaluates to /usr/lib/systemd/system on all Fedora systems (F-15+) 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}+` macro to exist, your package must have:

+ Please note that in order for the `+%{_unitdir}+` or `+%{_userunitdir}+` macro to exist, your package must have:

  

  ....

  BuildRequires: systemd-rpm-macros

I recently tweaked a package where the service file was installed in system location for systemd, but it needed to be in the user directory. While looking around for the proper macro to use, I noted this guideline implies you can't use %{_userunitdir}, so here's a small tweak pointing out this important alternative.

Metadata Update from @tibbs:
- Pull-request tagged with: meeting

2 years ago

I think there's a copy-paste error here.

+%{_userunitdir}%+ evaluates to /usr/lib/systemd/system

This should be

+%{_userunitdir}%+ evaluates to /usr/lib/systemd/user

1 new commit added

  • Fix directory path for _userunitdir.
2 years ago

I think there's a copy-paste error here.

+%{_userunitdir}%+ evaluates to /usr/lib/systemd/system

This should be

+%{_userunitdir}%+ evaluates to /usr/lib/systemd/user

Good catch, that different path was the kinda the whole point! :laughing: Fixed.

Looks good to me now. Thanks!

I wonder, does pagure allow squashing commits before merging a PR?

No, @troycurtisjr needs to do it before we merge it.

rebased onto 2055309a6413e745de327ba128e634c6a57beb84

2 years ago

rebased onto afd1596

2 years ago

Pull-Request has been merged by ngompa

2 years ago