wpkg --is-installed

Options Comments
--admindir Define the administration directory, where the database of the installed packages resides.
--debug Define a set of flags of things to print out for debug purposes.
--instdir Define the installation directory, where the data files are installed on the target.
--quiet Request for warning messages to not be displayed.
--root Define the installation root path.
--verbose Display the result as "true" or "false".

The --is-installed command allows you to write scripts that need to know whether a package is installed. By default it simple exits with 0 (installed) or 1 (not installed.)

if wpkg --is-installed <package-name>; then echo "Installed!"; fi

It is possible to use the --verbose flag to also get wpkg to print out the word "true" (if installed) or "false" (if not installed.) This is printed in stdout.

installed=`wpkg --verbose --is-installed <package-name>`
...
if $installed
then
   # do this if installed
   ...
fi

If you want to know the exact status of a package, you can use the --field command with X-Status instead:

wpkg --field <package-name> X-Status

IMPORTANT NOTES

The --status command in version 0.9.0 and newer behave exactly the same way as the --field command. In older versions it would print out the content of the X-Status field.