Subject: Re: DEINSTALL scripts for daemon packages
To: David Brownlee <abs@netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: tech-pkg
Date: 05/24/2001 11:14:14
David Brownlee <abs@netbsd.org> writes:
> > On Thu, 24 May 2001, David Brownlee wrote:
> > > By putting in in DEINSTALL you lose the ability to have
> > > 'check to see if it would be OK to remove this package'
> > > functionality.
> >
> > Right. s/DEINSTALL/REQ/ (do we still support that?).
> > >From pkg_delete(8):
> >
> > If the package contains a require file (see pkg_create(1)), then this is
> > executed first as
> > require <pkg-name> DEINSTALL
> > (where pkg-name is the name of the package in question and DEINSTALL is
> a
> > keyword denoting that this is a deinstallation) to see whether or not de
> -
> > installation should continue. A non-zero exit status means no, unless
> > the -f option is specified.
>
> Unless I'm missing something (always possible :) this locks us to
> one of the three choices:
> - ignore daemons on delete (where we are now)
> - fail with warning messages
> - shutdown daemons and proceed
No, you include some code in DEINSTALL like:
case DEINSTALL)
# ... check to see if daemon is running ...
if is_running; then
echo "The ${PKGNAME} daemon is still running!"
exit 2;
fi
Now if someone does 'pkg_delete foo', it'll fail if the foo daemon is
running because the DEINSTALL script returns a nonzero error. But if
they run 'pkg_delete -f foo', it'll still print the warning message,
but will force the deinstallation of the package.
This is the kind of stuff we should _not_ be adding to the pkg_install
sources. I mean, how do you check that the daemon is running across
all those differently named daemons in pkgsrc with different methods
of starting/stopping them? The only plausible way to achieve this
kind of check is to do it on a package-by-package basis, which is done
be doing the check at DEINSTALL time.
I really don't think we should be touching (3) in your list above: I
don't think that pkg_delete should be doing admin-type tasks like
turning off services for you.
Cheers,
-- Johnny C. Lam <lamj@stat.cmu.edu>
Department of Statistics, Carnegie Mellon University
http://www.stat.cmu.edu/~lamj/