Bug#790949: conditional-restart from postinst and related scripts of plugin packages
Package: debian-policy
Severity: important
Some of this has been discussed in other bugs such as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=60979
requesting an init script action for restart-only-if-running
Consider the following:
- package foo provides a daemon
- package foo-plugin-bar provides the 'bar' plugin for 'foo'
How should the foo-plugin-bar postrm work?
Should it restart foo?
Should it do a conditional restart?
During dist-upgrade, can anything be done to ensure the service is not
started by mistake by one of the postinst scripts until the other
package has also been upgraded?
In the policy manual, s9.3.3.2 "Running initscripts", it is suggested to
use:
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d package <action>
else
/etc/init.d/package <action>
fi
Could it be better to give a second example, how to restart only if
already running:
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d status package >/dev/null 2>&1 && \
invoke-rc.d package restart
else
/etc/init.d/package restart
fi
# whatever happened, return success:
true
Plugin packages, such as foo-plugin-bar, may want to use this second
example or some variation of it instead.
Reply to: