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

Checking for installed package



Hey list,

I'd like to know the most reliable way for a bash script to verify that
a package is installed on the user's system. I've looked already at
dpkg, dpkg-query, and aptitude. These are the constraints:

        1. It needs to work on any stock Debian based system, e.g.
        aptitude not always present, so can't rely on it.
        
        2. It needs to be i18n safe, e.g. no reliance on grepping for
        "Installed:" output of apt-cache policy <package> because that
        is en locale specific.
        
        3. It needs to be able to distinguish a package that is
        installed from any other condition with only the former we care
        about. That means the exit code, for instance, of the query
        should be never be the same for a package that is installed
        versus one that is not installed - and not available anywhere.

Any help appreciated.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: