Michael Biebl wrote on 18/11/14 15:09:
> 2014-11-18 15:59 GMT+01:00 Colin Guthrie <gm...@colin.guthr.ie>:
>> Didier Roche wrote on 18/11/14 13:58:
>>> This would be maybe a nice way for the admin to know what's coming from
>>> a distribution default or not. However, let's say I want to ensure that
>>> ssh will always be available on my server, I would (even if it's in my
>>> server preset) then systemctl enable openssh, no matter whatever future
>>> preset updates does (like disable it in the next batch upgrade).
>>
>> For the avoidance of doubt, I believe that running systemctl preset
>> should only ever happen on *first* install, never on upgrade or such like.
>>
> 
> And what are you going to do, if the unit file changes?
> Say v1  had
> 
> [Install]
> WantedBy=multi-user.target
> 
> and version B has
> [Install]
> WantedBy=foo.target


Well this is an edge case I'm sure you'll agree.

Ultimately, with this case, doing the preset is wrong anyway. You don't
want the distro choice, you want the "what the user had" choice.

So I'd expect the systemctl preset logic to *not* kick in (which it
won't as it's not the first install of the package), and (in RPM
parliance), I'd have a %triggerun  script for when the version before
the change was uninstalled (thus only triggering the fixup script once)
do something like:

if [ -L /etc/systemd/system/multi-user.target.wants/myservice.service ];
then
  mkdir -p /etc/systemd/system/foo.target.wants
  mv /etc/systemd/system/multi-user.target.wants/myservice.service
/etc/systemd/system/foo.target.wants/
  rmdir /etc/systemd/system/multi-user.target.wants >/dev/null
2>/dev/null ||:
fi

Or do it in LUA if I needed/wanted to avoid a shell dependency.

Yes, it's ugly but I doubt very much this kind of special can be easily
captured in a generic structure (or that it makes sense to even if it
could - I'm sure you could always define some way to break any mould!)

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to