Re: Bug#804018: dpkg: provide options to avoid service startup on package installation
On 19/11/15 12:43, Marc Haber wrote:
> Will this also work if a package does not come with a sysvinit init
Not in the same way. That's the deb-systemd-invoke code path, which
still respects policy-rc.d, but does not actually use invoke-rc.d to do it.
> or the sysvinit init script is overridden by a native systemd
This case does use invoke-rc.d, which knows how to invoke the systemd
and/or Upstart bits that come with a sysvinit script.
> Can a unit be masked before the corresponding package is installed?
Yes: systemctl mask whatever.service, or equivalently ln -fs /dev/null
> That being said, this bug is only about preventing a service from
> being started when the package is installed or updated. keepalived etc
> do need to be able to start the service manually, which is also
> prevented by systemd's mask mechanism.
>> Normal boot and shutdown do not use policy-rc.d, the same as in sysvinit.
> I didn't think about that. One would need a mechanism to prevent this
> as well since one probably doesn't want a keepalived-managed service
> to be started on system boot.
This sounds as though in addition to policy-rc.d, you also want a way to
avoid enabling the init script (update-rc.d whatever disable, but
preferably something you can set up in advance like you can for masking).
For systemd-only services, a package maintainer can use
dh_enable_systemd --no-enable whatever.service (which will not enable it
on install, but will still disable it on purge), but I don't think
there's an API for sysadmins to make this happen.
For services with a sysvinit script, I don't think dh_installinit has an
equivalent of --no-enable for maintainers' use either.