[Fedora-packaging] Error in the systemd scriptlet snippets

Aurélien Bompard gauret at free.fr
Fri Aug 30 11:08:16 UTC 2013


Hi packagers,

I just realized there's a mistake in the ScriptletsSnippets page about
the new systemd macros:
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Macroized_scriptlets_.28Fedora_18.2B.29

The page asks to add "Requires: systemd", but the macros are actually
expanded at build time and not at run time, thus it should simply be a
single "BuildRequires: systemd" line.

Example of the scriptlets when built without systemd:

# rpm -q --scripts mailman3
preinstall scriptlet (using /bin/sh):
[...]
postinstall scriptlet (using /bin/sh):
%systemd_post mailman3.service
preuninstall scriptlet (using /bin/sh):
%systemd_preun mailman3.service
postuninstall scriptlet (using /bin/sh):
%systemd_postun_with_restart mailman3.service

And I install time I get:

/var/tmp/rpm-tmp.FtLPUV: line 1: fg: no job control
warning: %post(mailman3-3.0.0-0.6.bzr7218.fc19.noarch) scriptlet failed,
exit status 1
Non-fatal POSTIN scriptlet failure in rpm package
mailman3-3.0.0-0.6.bzr7218.fc19.noarch

obviously because the "%" sign is interpreted as the job control command.
When built with systemd, the scriptlets look correct:

$ rpm -qp --scripts mailman3-3.0.0-0.6.bzr7220.fc19.noarch.rpm
preinstall scriptlet (using /bin/sh):
[...]
postinstall scriptlet (using /bin/sh):
if [ $1 -eq 1 ] ; then
        # Initial installation
        /usr/bin/systemctl preset mailman3.service >/dev/null 2>&1 || :
fi
preuninstall scriptlet (using /bin/sh):
[...] (expanded too)
postuninstall scriptlet (using /bin/sh):
[...] (expanded too)

This is on F19. Can you confirm that the wiki page should be fixed?
Thanks.

Aurélien
-- 
http://aurelien.bompard.org    ~~~~~~    xmpp:aurelien at bompard.org
"I used to think that the brain was the most wonderful organ in my body.
Then I realized who was telling me this." -- Emo Phillips


More information about the packaging mailing list