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

Tadej Janež tadej.j at nez.si
Sun Oct 25 08:21:26 UTC 2015


Hi Dominik,

On Thu, 2015-10-22 at 10:27 +0200, Dominik 'Rathann' Mierzejewski wrote:
> On Thursday, 22 October 2015 at 10:03, Tadej Janež wrote:
> > Hi!
> [...]
> > 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.
> 
> I wouldn't worry about rpmlint errors in this case. As you said
> yourself, there are not specific guidelines for packaging user instance
> services, so you've just entered unknown territory, so rpmlint errors
> related to that might be expected.

I understand, thanks for the explanation!

> Does the user instance service work as expected? If yes, then we would
> very much appreciate it if you documented your efforts in form of an
> update to the systemd packaging guidelines and submitted it in fpc trac
> (https://fedorahosted.org/fpc/). Filing a bug against rpmlint to support
> this way of service packaging is of course also a good idea.

Sure, I'll be happy to propose an update to the systemd packaging
guidelines to the FPC.

But first I would like to ask for some help regarding these systemd
macros.

The %systemd_user_post macro is defined as:
%systemd_user_post() %systemd_post --user --global %{?*}

And the %systemd_post macro is defined as:
%systemd_post() \
if [ $1 -eq 1 ] ; then \
        # Initial installation \
        systemctl preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}

Calling %systemd_user_post gives the following error:
[vagrant at localhost ~]$ rpm --eval '%systemd_user_post bup-web'
systemd_post: invalid option -- '-'
error: Unknown option - in systemd_post()

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset bup-web >/dev/null 2>&1 || : 
fi 

It appears to be a problem with the %systemd_post macro since calling it
without parameters (just with the 'bup-web' argument) works:
[vagrant at localhost ~]$ rpm --eval '%systemd_post bup-web'

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset bup-web >/dev/null 2>&1 || : 
fi 

However, if I try to pass some parameters (besides arguments) to it, it
returns an error:
[vagrant at localhost ~]$ rpm --eval '%systemd_post --user bup-web'
systemd_post: invalid option -- '-'
error: Unknown option - in systemd_post()

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset  >/dev/null 2>&1 || : 
fi 

Any ideas what's going on here and how to make it work?

Thanks and regards,
Tadej



More information about the packaging mailing list