public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] how to determine if a virtual is installed, from the shell?
@ 2003-08-19  2:31 Owen Gunden
  2003-08-19  2:43 ` Spider
  0 siblings, 1 reply; 4+ messages in thread
From: Owen Gunden @ 2003-08-19  2:31 UTC (permalink / raw
  To: gentoo-dev

So hypothetically, if I wanted to write a shell script that behaved
differently if virtual/mta was installed than if it was not, what would I
do?

I'd like a command that would return a specific exit status based on
whether or not the virtual dependency is there.  But frankly I'm willing to
use grep for a nice gross hack too.  Tell the truth, I don't even know how
to do this for regular (non-virtual) packages.

I've played around with qpkg, but with little luck.  Is there any way to do
this with or without qpkg?

TIA,
Owen

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] how to determine if a virtual is installed, from the shell?
  2003-08-19  2:31 [gentoo-dev] how to determine if a virtual is installed, from the shell? Owen Gunden
@ 2003-08-19  2:43 ` Spider
  2003-08-19  2:49   ` Owen Gunden
  2003-08-19  6:25   ` Mamoru KOMACHI
  0 siblings, 2 replies; 4+ messages in thread
From: Spider @ 2003-08-19  2:43 UTC (permalink / raw
  To: gentoo-dev

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

begin  quote
On Mon, 18 Aug 2003 22:31:47 -0400
Owen Gunden <ogunden@stwing.upenn.edu> wrote:

> So hypothetically, if I wanted to write a shell script that behaved
> differently if virtual/mta was installed than if it was not, what
> would I do?
> 
> I'd like a command that would return a specific exit status based on
> whether or not the virtual dependency is there.  But frankly I'm
> willing to use grep for a nice gross hack too.  Tell the truth, I
> don't even know how to do this for regular (non-virtual) packages.
> 
> I've played around with qpkg, but with little luck.  Is there any way
> to do this with or without qpkg?
> 


cat /var/cache/edb/virtuals   ...  this should give you the format
enough to work shell magic with it :)


//Spider


-- 
begin  .signature
This is a .signature virus! Please copy me into your .signature!
See Microsoft KB Article Q265230 for more information.
end

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-dev] how to determine if a virtual is installed, from the shell?
  2003-08-19  2:43 ` Spider
@ 2003-08-19  2:49   ` Owen Gunden
  2003-08-19  6:25   ` Mamoru KOMACHI
  1 sibling, 0 replies; 4+ messages in thread
From: Owen Gunden @ 2003-08-19  2:49 UTC (permalink / raw
  To: gentoo-dev

On Tue, Aug 19, 2003 at 04:43:50AM +0200, Spider wrote:
> cat /var/cache/edb/virtuals   ...  this should give you the format
> enough to work shell magic with it :)

Excellent.  Thanks.

Owen

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] how to determine if a virtual is installed, from the shell?
  2003-08-19  2:43 ` Spider
  2003-08-19  2:49   ` Owen Gunden
@ 2003-08-19  6:25   ` Mamoru KOMACHI
  1 sibling, 0 replies; 4+ messages in thread
From: Mamoru KOMACHI @ 2003-08-19  6:25 UTC (permalink / raw
  To: gentoo-dev

At Tue, 19 Aug 2003 04:43:50 +0200,
Spider wrote:
> 
> [1  <text/plain; US-ASCII (7bit)>]
> begin  quote
> On Mon, 18 Aug 2003 22:31:47 -0400
> Owen Gunden <ogunden@stwing.upenn.edu> wrote:
> 
> > So hypothetically, if I wanted to write a shell script that behaved
> > differently if virtual/mta was installed than if it was not, what
> > would I do?

> cat /var/cache/edb/virtuals   ...  this should give you the format
> enough to work shell magic with it :)

Alternatively, you can use has_version function.  If you want to use
it from normal shell script (not an ebuild), use

	/usr/bin/portageq has_version / 'virtual/mta' && ...

See man 5 ebuild for more detail.

-- 
Mamoru KOMACHI <usata@gentoo.org>
http://dev.gentoo.org/~usata/

--
gentoo-dev@gentoo.org mailing list


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

end of thread, other threads:[~2003-08-19  6:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-19  2:31 [gentoo-dev] how to determine if a virtual is installed, from the shell? Owen Gunden
2003-08-19  2:43 ` Spider
2003-08-19  2:49   ` Owen Gunden
2003-08-19  6:25   ` Mamoru KOMACHI

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