How to query installed packages with specific use flag

gentoo

I want to query a installed package, and it must have specified use flag:

e.g. eix -I curl:use flag

Currently I am using grep to filter the output. I want to know if it is possible to do it in one command line.

Best Answer

If you want to use eix, you can use its --installed-with-use option:

$ eix --installed-with-use ipv6 curl

You may omit the last argument to enumerate all of the query results for any installed package with a particular useflag:

$ eix --installed-with-use ipv6

If you need to check if a particular package is installed with a particular useflag and can use eix, then you could do:

#!/bin/sh
if ! eix -q --installed-with-use ipv6 net-misc/curl; then
    echo "Our distribution server only has an IPv6 address. Please reinstall net-misc/curl with USE=ipv6." >&2
    exit 1
fi
Related Question