help-cfengine
[Top][All Lists]
Advanced

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

Re: Suggestions on Testing for Packages


From: Brendan Strejcek
Subject: Re: Suggestions on Testing for Packages
Date: Wed, 2 Feb 2005 10:55:52 -0600
User-agent: Mutt/1.5.6+20040818i

Brian E. Seppanen wrote:

> Has anyone come up with a method they would be willing to describe or
> share on how I can use cfengine to determine if a package is installed
> on a debian host with dpkg, or solaris with pkginfo?

Sometimes I use:

classes:
    asdf = ( ReturnsZero(/bin/sh -c "/usr/bin/dpkg -L pkg >/dev/null 2>&1") )

Part of the problem though is that with dpkg, the state of being
installed is not a binary condition. There is a whole collection of
states that a package can be in, and many of them do not qualify for
what common sense says is "installed" or "uninstalled."

A more practical (but less elegant) method is to not test for what the
package manager thinks about the state of the package, but rather to
test for the service you need from the package. For example:

classes:
    bash_available = ( FileExists(/bin/bash) )

Solaris is easy though:

classes:
    SUNWusb = ( ReturnsZero(/bin/pkginfo -q SUNWusb) )

Also, several people have coded up backends to support the packages:
section directly in cfengine for these package managers, but I don't
think they have gotten into the mainline development yet. You might be
able to get some patches if you ask around on this list.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]