On 4/20/19 3:59 AM, Zbigniew Jędrzejewski-Szmek wrote:
On Fri, Apr 19, 2019 at 04:35:54PM -0400, John Florian wrote:
I'm generally familiar with how systemd presets work but I'm at a
bit of loss as to how part of all the magic works.  To best explain
my confusion, let me say that I make a customized live spin of
Fedora and I have a package we'll call "my-dist" which is similar in
nature to the "fedora-release" package in that it provides a custom
preset file.  I still use fedora-release because this spin is not
*that* customized, so it's best to think of this as an extension.  I
have another package we'll call "my-service" which has a systemd
service unit file and all the usual %systemd_post, etc. macros.
When I boot my live spin I find that my-service is not enabled
despite the preset in my-dist.  I can "systemctl preset-all" to
rectify this so I believe most requirements are correct.  I do see
that livemedia-creator installs my-service *before* it installs
my-dist so if the %systemd_post is called as each rpm is installed
that would explain my problem because my custom preset isn't present
yet.

How does Fedora itself accomplish this???  I don't see every package
providing a service having a dependency on fedora-release to address
this ordering issue.  I can certainly stick the "systemctl
preset-all" into the %post of my kickstart as final cleanup, but
that feels dirty and wrong.  Similarly, I don't wish to have to have
a "Requires: my-dist" in every one of "my-service" and other
packages like it.  I've scrutinized fedora-release.spec and didn't
see anything all that different than what I have in my-dist.
systemd.rpm does preset-all when it is installed, so it is enough
that systemd.rpm is installed after fedora-release-common.rpm.
fedora-release-common is required by setup.rpm, so it is installed
early. But you raise a good point — I don't see any *explicit*
ordering chain between fedora-release-common and systemd.

There is no need to order individual rpms against either
fedora-release-common and other packages providing presets or
systemd. The only thing that is necessary is for systemd.rpm to be
installed after all presets. If that is satisfied, packages proving
services can be installed both earlier and later and the effect
(in the sense of service enablement) should be identical.

Zbyszek
Thank you for the nicely detailed answer.  So if there's no explicit ordering chain in Fedora, does it mean that it's just luck to make it all work out?  If I read that right, it would seem that systemd would have to be one of the very last packages installed, but maybe it doesn't matter much for Fedora proper given how most everything is disabled by default.  Should I try to achieve that with my spin or is there even a way?  It would seem I would need some sort of reverse Requires to achieve this without touching Fedora's native packages.  I'm guessing that means doing a "systemctl preset-all" at the end of my kickstart is probably as good a solution as any.
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to