We want to stop systemd from being added to docker images, because of rpm requiring systemctl.

Kalev Lember kalevlember at gmail.com
Wed Apr 30 15:02:54 UTC 2014


On 04/30/2014 04:24 PM, Daniel J Walsh wrote:
> On 04/30/2014 10:05 AM, Kalev Lember wrote:
>> For example, when a package bar has a postinstall script that does:
>>
>>     systemctl enable bar.service >/dev/null 2>&1 || :
>>
>> .. but if systemctl gets installed _after_ foo in the same transaction,
>> then the systemctl command never runs and service stays disabled.
>>
>>
> Well you are never supposed to do this.  You are only supposed to do a
> systemctl reload bar in a post install.

No, pretty much all packages that install systemd unit files run either
'systemctl enable' or 'systemd preset' in %post. The latter is just
'systemd enable' wrapped in layer of indirection, that depending on
installed configuration either enables or disables the unit file.

The macro that systemd ships for postinstall and packages are supposed
to run, is %systemd_post. That expands to a 'systemctl enable' equivalent:

$ rpm -E %systemd_post

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


> Any package that does do an enable, should require systemd, as they
> are probably not candidates to run in a container.

Right. And enable ~= %systemd_post, which is why packages that use this
macro currently have Requires(post) on systemd.

-- 
Kalev


More information about the devel mailing list