[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

daemon stop and start during upgrade


Currently I am packaging a daemon.  I used dh-make (0.43, Debian
lenny) and did some small adjustments afterwards.  Now came across two
problems where I am not sure how they should solved properly, in other
words: What is best practise?

Given the following situation:  The daemon was stopped manually. Now I
want to install a new build, using "dpkg -i".  This invokes (among
other) /var/lib/dpkg/info/<daemon>.prerm which contains only a few lines
"Automatically added by dh_installinit".  They include a call of
"invoke-rc.d <daemon> stop || exit $?",
this is basically a wrapper for "/etc/init.d/<daemon> stop" which
calls start-stop-daemon.  This program returns non-zero since the
daemon is not running, that value is passed back through the chain and
finally causes a dpkg error.  dpkg tries the script from the new
package instead which fails for the same reason.

To deal with that mess I could modify /etc/init.d/<daemon> and add the
--oknodo to start-stop-daemon, or "|| true".  If this is the best way
to do, why does not dh-make create the init script in such a way by

An alternative approach was to ship my own version of prerm thus
overriding dh_installinit.  Not a good idea IMHO.

Is there a better solution?

A second question: I was told it was a wise idea to start the daemon
after an upgrade only if it was running before the upgrade. This means
catching the "is it running?" state in prerm and preserving it until
postinst. Is there a framework available for that task?  I am not keen
on re-inventing the wheel.


Attachment: signature.asc
Description: Digital signature

Reply to: