FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 02-12-2010, 08:16 AM
Helmut Jarausch
 
Default script to check if a package is installed ?

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
 
Old 02-12-2010, 08:38 AM
Alan McKinnon
 
Default script to check if a package is installed ?

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
 
Old 02-12-2010, 09:00 AM
Neil Bothwick
 
Default script to check if a package is installed ?

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.
 

Thread Tools




All times are GMT. The time now is 02:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org