Score:0

How to check if rpm virtual package is provided?

cn flag

I want to check if java-11-headless is installed. java-11-headless is a virtual package and it is provided e.g. by java-11-openjdk-headless.x86_64 package. I do not care what exactly package provides java-11-headless I only want to check if java-11-headless is installed.

I googled my issue and all answers concern checking certain package (e.g. java-11-openjdk-headless.x86_64) , not virtual package (java-11-headless).

As you can see below java-11-openjdk-headless.x86_64 is isnalled:

[root@21b70cb5fc59 /]# rpm -q java-11-openjdk-headless.x86_64
java-11-openjdk-headless-11.0.16.1.1-1.el7_9.x86_64
[root@21b70cb5fc59 /]# echo $?
0 

[root@21b70cb5fc59 /]# yum list installed java-11-openjdk-headless.x86_64
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: artfiles.org
 * extras: centos.bio.lmu.de
 * updates: centos.intergenia.de
Installed Packages
java-11-openjdk-headless.x86_64

Unfortunately I do not know how to check if java-11-headless is installed.

[root@21b70cb5fc59 /]# rpm -q java-11-headless
package java-11-headless is not installed
[root@21b70cb5fc59 /]# echo $?
1


[root@21b70cb5fc59 /]# yum list installed java-11-headless
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: artfiles.org
 * extras: centos.bio.lmu.de
 * updates: centos.intergenia.de
Error: No matching Packages to list
[root@21b70cb5fc59 /]# echo $?
1
br flag
how about `yum list installed | egrep java-11\.\*headless` is that OK for you?
Mariusz avatar
cn flag
In my case it should work but it is possible that there is some package that provides java-11-headless and does not meet your check. I would like to have more generic solution.
br flag
you can adjust the egrep but you're going to need to have some idea what you're looking for.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.