On Sun, Sep 06, 2015 at 02:23:57PM +0200, Jens Reyer wrote:
> On 09/06/2015 08:30 AM, Gianfranco Costamagna wrote:
> > dpkg -s nvidia-cuda-toolkit | grep -o installed
>
> "installed" is also part of the output of a non-installed package.
>
> Still not 100% failproof alternative:
> 19 ifeq (installed, $(shell dpkg -s nvidia-cuda-toolkit | grep Status | grep -o installed))
>
> or (untested and I don't know if there are valid alternatives):
>
> 19 if ($(shell dpkg -s nvidia-cuda-toolkit | grep -o "Status: install ok installed")
Well, you could always do something like this:
dpkg-query -W -f '${Status}' nvidia-cuda-toolkit 2>/dev/null | fgrep -x 'install ok installed'
...or, if it's okay for you to depend on a recent-ish version of dpkg-dev -
1.17.11, to be precise, only available in unstable, testing, and stable
(jessie), so it could be a bit rough on backports to squeeze or earlier:
dpkg-query -W -f '${db:Status-Abbrev}' nvidia-cuda-toolkit 2>/dev/null | fgrep -x 'ii '
Of course, both of these would need a bit more escaping if used in
a Makefile-style file like debian/rules.
G'luck,
Peter
--
Peter Pentchev roam@ringlet.net roam@FreeBSD.org pp@storpool.com
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
Attachment:
signature.asc
Description: Digital signature