public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] script to check if a package is installed ?
@ 2010-02-12  9:16 Helmut Jarausch
  2010-02-12  9:38 ` Alan McKinnon
  0 siblings, 1 reply; 3+ messages in thread
From: Helmut Jarausch @ 2010-02-12  9:16 UTC (permalink / raw
  To: gentoo-user

Hi,

does anybody know how to check if a package is installed using a script/
shell.

Unfortunately   eix -I -q  CAT/PACK
produces a return code of 0 irrespectively if CAT/PACK
is install or not.

I'd like to say

for P in  .......; do
  if  CHECK_IF_INSTALLED $P; then echo $P; fi
done

What to replace for  CHECK_IF_INSTALLED ?

Many thanks for a hint,
Helmut.

-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] script to check if a package is installed ?
  2010-02-12  9:16 [gentoo-user] script to check if a package is installed ? Helmut Jarausch
@ 2010-02-12  9:38 ` Alan McKinnon
  2010-02-12 10:00   ` Neil Bothwick
  0 siblings, 1 reply; 3+ messages in thread
From: Alan McKinnon @ 2010-02-12  9:38 UTC (permalink / raw
  To: gentoo-user

On Friday 12 February 2010 11:16:22 Helmut Jarausch wrote:
> Hi,
> 
> does anybody know how to check if a package is installed using a script/
> shell.
> 
> Unfortunately   eix -I -q  CAT/PACK
> produces a return code of 0 irrespectively if CAT/PACK
> is install or not.
> 
> I'd like to say
> 
> for P in  .......; do
>   if  CHECK_IF_INSTALLED $P; then echo $P; fi
> done
> 
> What to replace for  CHECK_IF_INSTALLED ?

check for the existence of /var/db/pkg/$CAT/%PKG-* using test -f

This is not 100% accurate though, as kdebase-menu returns positive if kdebase-
menu-icons is installed and kdebase-menu is not

-- 
alan dot mckinnon at gmail dot com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] script to check if a package is installed ?
  2010-02-12  9:38 ` Alan McKinnon
@ 2010-02-12 10:00   ` Neil Bothwick
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Bothwick @ 2010-02-12 10:00 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

On Fri, 12 Feb 2010 11:38:04 +0200, Alan McKinnon wrote:

> > Unfortunately   eix -I -q  CAT/PACK
> > produces a return code of 0 irrespectively if CAT/PACK
> > is install or not.
> > 
> > I'd like to say
> > 
> > for P in  .......; do
> >   if  CHECK_IF_INSTALLED $P; then echo $P; fi
> > done
> > 
> > What to replace for  CHECK_IF_INSTALLED ?  
> 
> check for the existence of /var/db/pkg/$CAT/%PKG-* using test -f

if [[ "$(eix -I -e cat/pkg)" != "No matches found" ]]; then...

if [[ -n "$(qlist -Ie cat/pkg)" ]]; then...


-- 
Neil Bothwick

Anything worth fighting for is worth fighting dirty for.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-12 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12  9:16 [gentoo-user] script to check if a package is installed ? Helmut Jarausch
2010-02-12  9:38 ` Alan McKinnon
2010-02-12 10:00   ` Neil Bothwick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox