Question

Is there a way to ask yum which group(s) contain a given package? I know how to ask what packages are in a given group, and could write a quick script to trawl over all of the groups, but it would be nice to have a simpler mechanism than that.

Was it helpful?

Solution

If you are only looking for a 'simpler mechanism' to be used by a human and don't need it in some kind of script or so, you might get by with this one:

yum groupinfo '*' | less +/sendmail-cf

Of course, replace sendmail-cf with the package name you're interested in.

OTHER TIPS

You can find a group to which the specified package belongs, by using yum-list-data plugin.

$ sudo yum -y install yum-plugin-list-data

$ yum -C list-groups ftp
Loaded plugins: fastestmirror, list-data
==================== Available Packages ====================
Console internet tools      1 (100%)
list-groups done

Or, if you are not allowed to install the plugin, please save the following script and try to run it with one argument, the name of the package you try to find:

#!/bin/sh

search_name=$1
LANG=C yum grouplist -v | grep "^  " | awk -F'(' '{print $1}' | sed -e 's/^ *//' | while     read line
do
    if [ "${search_name}" != "" ]; then
        yum groupinfo "${line}" | grep -q "^ *${search_name}$"
        if [ $? -eq 0 ]; then
            echo ${line}
            break
        fi
    fi
done

I don't know about yum, but remember that it sits on top of rpm. The rpm command you're looking for is:

rpm -q --qf %{group} yourRPM

You might want to add a \n at the end, depending on that you are up to:

[root@Niflheim ~]# rpm -q --qf %{group} setarch
System Environment/Kernel[root@Niflheim ~]# rpm -q --qf "%{group}\n" setarch
System Environment/Kernel
[root@Niflheim ~]#
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top