Subject: DEINSTALL scripts for daemon packages
To: None <>
From: Jon Buller <>
List: tech-pkg
Date: 05/23/2001 21:49:32
I'll quote parts of an exchange between myself and agc, rather
than paraphrase and rewrite big parts...

jonb> On Mon, May 21, 2001 at 01:10:33PM -0700, Jon Buller wrote:

jonb> I was thinking about one other event I noticed when I unintentionally
jonb> pkg_delete'd postgresql.  The server was still left running.  This
jonb> left me in the slightly awkward position that I couldn't properly
jonb> shutdown the database, since the tools to do so had already been
jonb> removed.  I didn't think or care about it at the time, but the
jonb> thought has since crossed my mind that perhaps any package that
jonb> runs something as a daemon should stop the daemon(s) when removing
jonb> the package to allow an orderly shutdown.

jonb> As a very quick initial investigation, I found that there are 49
jonb> packages that list something in etc/rc.d in their PLIST.  Assuming
jonb> that this is roughly the number of packages that run daemons, and
jonb> that my statements above are accepted, there should be a DEINSTALL
jonb> script in each one to stop the daemons before the pkg_delete
jonb> finishes.  However, only 16 of those 49 packages have a DEINSTALL
jonb> script, and none of those 16 deinstall scripts have any occurance
jonb> of the letter pair "rc".

agc > On Tue, 22 May 2001 08:25:08 +0100, Alistair Crooks wrote:

agc > Sounds like an excellent idea to me, and something that would add huge
agc > value to pkgsrc - I don't think we've really had a good look at our
agc > rc.d stuff already.

agc > Having packages DTRT as well would be good.

So, now for a few questions and comments:

I have since altered my ideas on this a bit.  I now think it would
be better to check if the daemon in question is running,  and if
it is, print some sort of message and abort the pkg_delete.

1) Anyone want to recommend if the DEINSTALL script should abort the
   pkg_delete if the daemon involved is running, or kill the daemon
   and continue?

2) Are there any known exceptions to this?  (That is, anyone know
   of a time/place/package where this would be a bad idea.  I assume
   one may turn up while I'm looking, but thought an early warning
   might help me think of what to do before I commit an obviously
   stupid thing in a place I didn't think enough about it, or didn't
   realize that it should be an exception.)

3) Anyone have any other suggestions?

4) Anyone want to help?