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

Re: Checking for installed package-alternative in a wrapper-skript



On Sat, Jun 22, 2002 at 07:08:00PM +0200, Andreas Metzler wrote:
> Hello,
> Is there some canonical fast way to check in a script whether inn,
> inn2 or cnews is installed on the system?

> I need to know it in newsx's wrapper skript to set the correct
> options. Until now I've used
> if [ -e /usr/share/doc/inn/copyright ] ...
> which works well, but breaks policy 13.3. I would have liked to check
> for existence of /var/lib/dpkg/info/$package.list, but this'll still
> be there if the package is deinstalled but not purged.

> I'd rather not check for some files in the package like
> /usr/lib/news/input/newsrun vs. /usr/sbin/ctlinnd because they tend
> to be moved around, and calling dpkg'd be slow.
>              thanks, cu andreas

What do you do differently depending on which of these packages are
installed?  The best way to handle it is by directly testing for
*exactly* those parts of the package that you use -- that is, if you
invoke a different program for each of the packages, look for the exact
binary.

Checking for anything in /usr/share/doc is not kosher; policy requires
that you not depend on anything in that directory for a package to
function correctly.  Checking for actual features that are going to be
used is always the safest solution -- and often the most efficient.

Steve Langasek
postmodern programmer

Attachment: pgpTO4fheuKgj.pgp
Description: PGP signature


Reply to: