[Fedora-packaging] How to package systemd user instance services?

Tadej Janež tadej.j at nez.si
Thu Oct 22 08:03:19 UTC 2015


Hi!

First a little context. I'm in the process of packaging bup [1] (review
request [2]), a backup system based on the git packfile format.

One of its sub-commands/functionalities is "bup web" [3], a web server
for browsing through bup repositories. By default, "bup web" will show
the bup repository stored in user's ~/.bup directory.
Thus, it seems most appropriate to provide a systemd user instance
service which a user can enable and start.

Since the current systemd packaging guidelines [4] don't mention user
instance services at all, I've researched this a bit and found that the
systemd package ships /usr/lib/rpm/macros.d/macros.systemd file, which
contains various "user" macros:
- %_userunitdir
- %systemd_user_post
- %systemd_user_preun
- %systemd_user_postun
- %systemd_user_postun_with_restart

My naive attempt at using them was to follow [4] and just replace all %
systemd_* calls with appropriate %systemd_user_* calls (and %_unitdir
with %_userunitdir). The SPEC file can be viewed here:
https://github.com/tjanez/bup-package/blob/5f4abed/bup.spec

However, this doesn't work as expected. This is the output of rpmlint:

Rpmlint
-------
Checking: bup-0.27-0.3.fc24.x86_64.rpm
          bup-web-0.27-0.3.fc24.x86_64.rpm
          bup-0.27-0.3.fc24.src.rpm
bup.x86_64: W: spelling-error Summary(en_US) packfile -> pack file,
pack-file, packsaddle
[... trimmed spelling warnings ...]
bup-web.x86_64: W: empty-%postun
bup.src: W: spelling-error Summary(en_US) packfile -> pack file,
pack-file, packsaddle
[... trimmed spelling warnings ...]
bup.src: E: specfile-error systemd_post: invalid option -- '-'
bup.src: E: specfile-error error: Unknown option - in systemd_post()
3 packages and 0 specfiles checked; 2 errors, 15 warnings.

Rpmlint (installed packages)
----------------------------
bup-web.x86_64: W: empty-%postun
3 packages and 0 specfiles checked; 0 errors, 1 warnings.

I would appreciate help and feedback on this topic.

Thanks and regards,
Tadej

[1] https://bup.github.io/
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1222334
[3] http://bup.github.io/man/bup-web.html
[4] https://fedoraproject.org/wiki/Packaging:Systemd



More information about the packaging mailing list