#431 Introduce new systemd-rpm macros in 389-ds-base spec file
Closed: Fixed None Opened 7 years ago by rmeggins.

https://bugzilla.redhat.com/show_bug.cgi?id=850385 (Fedora)

Fedora 18 changes the way how to work with services in spec files. It
introduces new macros - %systemd_post, %systemd_preun and %systemd_postun;
which replace scriptlets from Fedora 17 and older (see
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd,
https://bugzilla.redhat.com/show_bug.cgi?id=850016).

Added initial screened field value.

Most of the changes for post/preun is for snmp. Tested that the snmp service is stopped when the package is removed. DS setup and removal works fine.

Sending out for review...

We still need to do
/bin/systemctl daemon-reload >$output 2>&1 || :
in %post, and this should be done after
%systemd_post %{pkgname}-snmp.service

%systemd_post runs the systemctl preset command, and we probably need to do a daemon-reload before that

Replying to [comment:7 rmeggins]:

We still need to do
/bin/systemctl daemon-reload >$output 2>&1 || :

You are correct, I was thrown off by the link provided in the description:

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Here it "seems" to show that the macro does the daemon-reload (fedora 17 scriptlet example)

in %post, and this should be done after
%systemd_post %{pkgname}-snmp.service

%systemd_post runs the systemctl preset command, and we probably need to do a daemon-reload before that

Not sure if this is a mistake, as you say we need to the daemon-reload after systemd_post, but then you say we need to before. If it both before and after?

You can always use
rpm --eval %macroname
to see what a macro evaluates to e.g. rpm --eval %systemd_post

You have to run daemon-reload after any config changes - I don't know if the "preset" command counts as a config change, but I would assume it does, so do the daemon-reload after systemd_post.

[mareynol@localhost 389-ds-base]$ git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 441 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Emitting a message to the fedmsg bus.
To ssh://mreynolds@pkgs.fedoraproject.org/389-ds-base
dd89b9d..81c22d3 f18 -> f18
[
[mareynol@localhost 389-ds-base]$ git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 484 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Emitting a message to the fedmsg bus.
To ssh://mreynolds@pkgs.fedoraproject.org/389-ds-base
4283ccd..3dfc57b master -> master

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.3.0

3 years ago

Login to comment on this ticket.

Metadata