Systemd Preset Policy
zbyszek at in.waw.pl
Sat Jul 25 05:00:43 UTC 2015
On Sat, Jul 25, 2015 at 04:10:28AM +0100, Sérgio Basto wrote:
> Let me see if I understand , on 2015-05-20  FESCo has decided to
> merge some of the policy around service units, socket units and timer
> units into a single policy that treats all units that run as default the
> same way.
> Note: decision made 6 days before Fedora 22 Final Release.
That's not particularly relevant, becuase the old way of doing things
still works, even though it is deprecated by the guidelines.
> We got some new wiki pages  - How to enable a service by default ?
> Services are enabled or disabled by default through systemd preset files
Yes. This centralizes the policy as to which services should be enabled
by default. It also makes it very easy to create custom policy in a
product / spin / local deployment / etc.
> But before that I used a script to enable services like this:
> %post guest
> /bin/systemctl daemon-reload >/dev/null 2>&1 || :
> /bin/systemctl restart systemd-modules-load.service >/dev/null 2>&1 || :
> /bin/systemctl enable vboxservice.service >/dev/null 2>&1 || :
> /bin/systemctl restart vboxservice.service >/dev/null 2>&1 || :
> This kind of scriptlet still works on Fedora 22 (updated), on a new
> installation ?
Yes, that still works, but should be converted to the new way of doing
things. So most likely you'd want to first file a bug against
fedora-release (see below), and after it is resolved, modify your
package to use %systemd_post.
> Other wiki page shows that PackagePresets are from Fedora 18 ! 
That is when this functionality was originally introduced. What changed
now is that presets has become *the* official way to enable services by
default. It is less convenient for packagers, but is more convenient for
admins and products.
> And what is the best way to set a preset for a service ? that we want
> enable by default, when is installed .
> Note: I'm asking this because I don't saw any example on package
 shows the syntax in the spec file (common for all services), and 
shows the additional steps which need to be taken for enabled-by-default
More information about the devel