46010f8 Stop using %systemd_requires for packages which only install unit files

Authored and Committed by zbyszek 4 years ago
    Stop using %systemd_requires for packages which only install unit files
    
    Nowadays systemd.rpm does a preset-all call when it is installed.
    This means that individual packages which provide systemd units and
    call %systemd_post in their %post will work fine no matter if they
    are installed *before* or *after* systemd.
    
    If installed *after*, the sequence is:
    ...
    1. install systemd, systemctl preset-all is called
    2. install package with a.service, %systemd_post calls systemctl preset a.service
       (a.service is enabled if presets say so).
    
    If installed *before*:
    ...
    1. package is installed, %systemd_post calls systemctl preset a.service, but
       nothing happens because /usr/bin/systemctl is not found.
       (The scriptlet is conditionalized using [ -x /usr/bin/systemctl ], so no
        error or warning is emitted.)
    2. systemd is installed, systemctl preset-all is called
       (a.service is enabled if presets say so).
    
    If systemd is not installed at all:
    the service is never enabled, and there's generally no way to run the service
    using systemd. This might happen for example when building a custom container
    image or systemd portable. I think that's totally reasonable, if systemd should
    be used in the image, it should be declared explicitly, and not pulled in as
    a dependency of some random package.
    
    During upgrades:
    %systemd_postun_with_restart calls systemctl try-restart. If systemd is not
    installed, than the service is obviously not running, so there's nothing to
    restart.
    
    The advantages of removing the dependency are:
    1. it is easier to build custom images of various sorts, because systemd is
       a big package and pulls in a *lot* of dependencies. For specialized use cases
       this is totally unnecessary.
    2. when those depencencies are removed, rpm has more freedom to order
       the transaction. In case there are other constrains on the ordering
       (that actually matter), there's less chance of circular dependencies and
       it's more likely that rpm will be able to honour those other constraints.
    3. "less is more" in general.
    
    Please note that this applies to calls to systemctl preset and
    systemctl try-restart. If the package calls some other systemd tool,
    for example systemd-tmpfiles or systemd-sysusers, or otherwise requires
    systemd to be installed, it should retain appropriate dependencies.