How to stop or uninstall screenly on raspberry pi? - raspberry-pi

As I am implementing digital signage with Dell Monitor.
First thing as I already google there is no option to stop or uninstall screenly & get back to raspberry pi desktop.
I want to know, how we can do that?
pi#raspberrypi ~ $ /opt/vc/bin/tvservice -s
state 0x120016 [DVI DMT (4) RGB full 4:3], 640x480 # 60Hz, progressive
My monitor maximum resolution is 1920x1200 with 16:10 aspect ratio, why tvservice giving me above mentioned output?
thanks in advanced,
Bhushan Vaiude

Here is ans:
ps aux | grep creen
less ~/screenly/misc/gtkrc-2.0
less ~/.config/openbox/lxde-rc.xml.bak
less ~/.config/openbox/lxde-rc.xml
less ~/.config/lxpanel/LXDE/panels/panel.bak
less /etc/xdg/lxsession/LXDE/autostart.bak
ulink /etc/supervisor/conf.d/screenly.conf
unlink /etc/supervisor/conf.d/screenly.conf
sudo unlink /etc/supervisor/conf.d/screenly.conf
sudo unlink ~/.gtkrc-2.0
ls -l ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/
unlink ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/
ls -l ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/mv ~/.config/openbox/lxde-rc.xml.bak ~/.config/openbox/lxde-rc.xml
mv ~/.config/openbox/lxde-rc.xml.bak ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/openbox/lxde-rc.xml
ls ~/.config/lxpanel/LXDE/panels/panel
ls ~/.config/lxpanel/LXDE/panels/pane*
mv ~/.config/lxpanel/LXDE/panels/panel.bak ~/.config/lxpanel/LXDE/panels/panel
sudo ls -l /etc/xdg/lxsession/LXDE/autostart
sudo ls -l /etc/xdg/lxsession/LXDE/autostart*
sudo mv /etc/xdg/lxsession/LXDE/autostart.bak /etc/xdg/lxsession/LXDE/autostart
less /etc/lightdm/lightdm.conf
sudo nano /etc/lightdm/lightdm.conf
#comment xserver-command
sudo shutdown -r now
thanks!

Related

How can I repack initramfs image on RHEL7?

On RHEL 7 the initramfs image file format changed. To unpack the image the skipcpio is needed. for example
/usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-957.el7.x86_64.img | gunzip -c | cpio -idmv
I succeeded to unpack the image with the command above but I cannot pack it back.
The old way (like it was on RHEL 6) is not working (
find . | cpio -o -c | gzip -9 > /boot/new.img
Is it possible to pack the image back on RHEL7?
Thanks
I got a solution when RHEL7 has the .img file packed in more complex way. Hints to its structure were described in https://ahelpme.com/linux/tips/unpack-centos-7-initramfs-file-with-and-without-dracut-skipcpio/, however there were no instructions for repacking after modification. Here I show the whole process:
cd /tmp
rm -f tryMe.img
rm -f initramfs-tmp.img
rm -rf cc
rm -f modified.gz
mkdir cc
cd cc
cat /boot/initramfs-3.10.0-1062.4.1.el7.x86_64.img | cpio -idmv # note number of blocks in
# output; I assume 4976
find . | cpio -o -H newc > /tmp/tryMe.img
rm -rf *
dd if=/boot/initramfs-3.10.0-1062.4.1.el7.x86_64.img of=../initramfs-tmp.img bs=512 skip=4976
zcat ../initramfs-tmp.img | cpio -idm
find . | cpio --create --format='newc' > /tmp/modified
gzip -9 /tmp/modified
cat /tmp/modified.gz >> /tmp/tryMe.img
#backup your original somehow and then
mv /tmp/tryMe.img /boot/initramfs-3.10.0-1062.4.1.el7.x86_64.img
The packing is the same as old Red Hat Enterprise Linux (RHEL) versions:
find . | cpio -o -H newc > ../initramfsFile
gzip -c ../initramfsFile > initramfsFils.img

Image dump fails during operation

I use the openocd script below to dump the flash memory of a STM32 microcontroller.
mkdir -p dump
openocd -f board/stm3241g_eval_stlink.cfg \
\
-c "init" \
-c "reset halt" \
-c "dump_image dump/image.bin 0x08000000 0x100000" \
-c "shutdown" \
FILENAME=dump/image.bin
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
The script is supposed to read the whole memory which is 1MB in my case but it does it very rarely. Generally it stops reading the memory before the end.
Why can't I obtain 1MB each time I execute this script? What is the problem here to cause openocd stop dumping the rest of the memory?
You can use dfu-utils to reflash your STM32 micros.
In Ubuntu/Debian distros you can install dfu-utils with apt:
$ sudo apt-get install dfu-util
$ sudo apt-get install fwupd
Boot your board in DFU mode (check datasheet). Once in DFU mode, you should see something similar to this:
$ lsusb | grep DFU
Bus 003 Device 076: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Once booted in DFU mode, reflash your binary:
$ sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/$(PROJECT).bin
With -d option you choose product:vendorid such as listed by lsusb in DFU mode.
With the -a 0 option you select alternate mode 0, check the options available as in the following example:
$ sudo dfu-util -l
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=1, name="#Option Bytes /0x1FFFF800/01*016 e", serial="FFFFFFFEFFFF"
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=0, name="#Internal Flash /0x08000000/064*0002Kg", serial="FFFFFFFEFFFF"
As you can see, alt=0 is for internal flash memory.
With the -s option you specify the flash memory address where you save your binary. Check your memory map in datasheet.
Hope this helps! :-)

How to upgrade docker-compose to latest version

I have installed docker-compose using the command
sudo apt install docker-compose
It installed docker-compose version 1.8.0 and build unknown
I need the latest version of docker-compose or at least a version of 1.9.0
Can anyone please let me know what approach I should take to upgrade it or uninstall and re-install the latest version.
I have checked the docker website and can see that they are recommending this to install the latest version'
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
But before that, I have to uninstall the present version, which can be done using the command
sudo rm /usr/local/bin/docker-compose
but this can be used only when the installation was done using curl. I am not sure if the installation was done by curl as I have used
sudo apt install docker-compose
Please let me know what should I do now to uninstall and re-install the docker-compose.
First, remove the old version:
If installed via apt-get
sudo apt-get remove docker-compose
If installed via curl
sudo rm /usr/local/bin/docker-compose
If installed via pip
pip uninstall docker-compose
Then find the newest version on the release page at GitHub or by curling the API and extracting the version from the response using grep or jq (thanks to dragon788, frbl, and Saber Hayati for these improvements):
# curl + grep
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')
# curl + jq
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
Finally, download to your favorite $PATH-accessible location and set permissions:
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION
The easiest way to have a permanent and sustainable solution for the Docker Compose installation and the way to upgrade it, is to just use the package manager pip with:
pip install docker-compose
I was searching for a good solution for the ugly "how to upgrade to the latest version number"-problem, which appeared after you´ve read the official docs - and just found it occasionally - just have a look at the docker-compose pip package - it should reflect (mostly) the current number of the latest released Docker Compose version.
A package manager is always the best solution if it comes to managing software installations! So you just abstract from handling the versions on your own.
If you tried sudo apt-get remove docker-compose and get E: Unable to locate package docker-compose, try this method :
This command must return a result, in order to check it is installed here :
ls -l /usr/local/bin/docker-compose
Remove the old version :
sudo rm -rf docker-compose
Download the last version (check official repo : docker/compose/releases) :
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
(replace 1.24.0 if needed)
Finally, apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Check version :
docker-compose -v
If the above methods aren't working for you, then refer to this answer: https://stackoverflow.com/a/40554985
curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" > ./docker-compose
sudo mv ./docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
Based on #eric-johnson's answer, I'm currently using this in a script:
#!/bin/bash
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
output='/usr/local/bin/docker-compose'
curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output
chmod +x $output
echo $(docker-compose --version)
it grabs the latest version from the GitHub api.
Here is another oneliner to install the latest version of docker-compose using curl and sed.
curl -L "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
Do it in three steps. (showing for apt-get installs)
Uninstall the last one. e.g. for apt-get installs
sudo apt-get remove docker-compose
Install the new one (https://docs.docker.com/compose/install/)
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
and then
sudo chmod +x /usr/local/bin/docker-compose
Check your version
docker-compose --version
Simple Solution to update docker-compose
This will remove the existing binary of docker-compose and install a new version.
sudo cd /usr/local/bin && sudo rm -rf docker-compose
sudo sudo curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x docker-compose
for the latest version visit https://github.com/docker/compose/releases and replace the latest one with v2.1.1
I was trying to install docker-compose on "Ubuntu 16.04.5 LTS" but after installing it like this:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
I was getting:
-bash: /usr/local/bin/docker-compose: Permission denied
and while I was using it with sudo I was getting:
sudo: docker-compose: command not found
So here's the steps that I took and solved my problem:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
use this from command line: sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Write down the latest release version
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Then test version:
$ docker-compose --version
If you installed with pip, to upgrade you can just use:
pip install --upgrade docker-compose
or as Mariyo states with pip3 explicitly:
pip3 install --upgrade docker-compose
Using latest flag in url will redirect you to the latest release of the repo
As OS name is lower case in github's filename, you should convert uname -s to lower case using sed -e 's/\(.*\)/\L\1/'.
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s|sed -e 's/\(.*\)/\L\1/')-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
On mac (also working on ubuntu):
sudo curl -L "https://github.com/docker/compose/releases/download/<release-version>/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
NOTE: write the as here:
https://github.com/docker/compose/releases
Use,
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v
Docker Engine and Docker Compose Plugin
Since Microsoft took over Docker they worked on porting docker-compose to their Docker Engine CLI plugins. For future support and updates I would recommend using docker compose plugin (Notice the missing dash) which can be install via the docker-compose-plugin package. The following instructions assume that you are using Ubuntu as Distro or any Distro thats using apt as package manager.
Installation Preparations
Update your mirrors:
sudo apt-get update
Make sure the following packages are installed:
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
After that add the official Docker GPG Key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
And finally add the the stable repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Also make sure Docker Engine and other needed dependencies are installed:
sudo apt-get install docker-ce docker-ce-cli containerd.io
Installation of docker compose plugin
sudo apt-get install docker-compose-plugin
Any future updates of the plugin are easily applied via apt.
For further reference take a look at the official installation instructions of Docker Engine and Docker Compose.
After a lot of looking at ways to perform this I ended up using jq, and hopefully I can expand it to handle other repos beyond Docker-Compose without too much work.
# If you have jq installed this will automatically find the latest release binary for your architecture and download it
curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | jq --arg PLATFORM_ARCH "$(echo `uname -s`-`uname -m`)" -r '.assets[] | select(.name | endswith($PLATFORM_ARCH)).browser_download_url' | xargs sudo curl -L -o /usr/local/bin/docker-compose --url
On ubuntu desktop 18.04.2, I have the 'local' removed from the path when using the curl command to install the package and it works for me. See above answer by Kshitij.
In my case, using Windows + WSL2 with Ubuntu 20.04, was necessary only this:
sudo apt update
and then:
sudo apt upgrade
Centos/RHEL
Follow my answer below if you're using Centos7 with an x86-64 architecture. This answer is also available in my github.
Stop Your Docker Containers
I noticed other answers did not talk about stopping your docker containers/images instances before attempting to upgrade gracefully. Assumptions are inevitable but can be costly. Onward we go!
Options to update Docker-Compose
There are 2 options to upgrade docker-compose if you first downloaded and installed docker-compose using the Curl command.
Using Curl, jq package, and Github's direct URL to the docker-compose repository.
Using Curl, Sed, and Github's direct URL to the docker-compose repository.
Note: some of the commands below require "sudo" privileges.
Demonstration
The script below was saved to a file called "update_docker_compose.sh". You need to give this file executable permissions.
Like so:
chmod +x update_docker_compose.sh
"docker_docker_compose.sh" file content:
#!/bin/bash
# author: fullarray (stackoverflow user)
# Contribution shared on: stackoverflow.com
# Contribution also available on: github.com
# date: 06112022
# Stop current docker container running
docker stop containerID
# Remove current docker network running
docker rm containerID
# Remove image of target application(s)
docker image rm imageID
# Delete either dangling (unatagged images) docker containers or images or network
docker system prune -f
# This step depends on the jq package.
# Uncomment jq package installation command below if using Centos7 x86-64.
# sudo yum install jq
# Declare variable to get latest version of docker-compose from github repository
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
# Declare variable to target installation directory
target_install_dir='/usr/local/bin/docker-compose'
# Get OS and build (assumes Linux Centos7 and x86_64)
get_local_os_build=$(uname -s)-$(uname -m)
# Execute curl command to carry download and installation operation
curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$get_local_os_build -o $target_install_dir
# Use chmod to modify permissions to target installation directory (to make it executable)
chmod +x $target_install_dir
# Print docker-compose version to terminal to verify upgrade
$(docker-compose --version)
Edit the script with variables specific to your environment
The script above has a few variables you need to edit with values specific to your docker environment. For instance, you need to replace container ID and image ID with the values that the following commands output.
docker ps
and
docker images output
Once you finalize creating the file (including the edits). Switch to the directory that contains the file. For example, if you created the file in /home/username/script/update_docker_compose.sh
cd /home/username/script
Last, run the script by executing the following
./update_docker_compose.sh
Option 2
Create a script file name "update_docker_compose.sh"
Edit the file and add the following content:
#!/bin/bash
# author: fullarray (stackoverflow user)
# Contribution shared on: stackoverflow.com
# Contribution also available on: github.com
# date: 06112022
# Stop current docker container running
docker stop containerID
# Remove current docker network running
docker rm containerID
# Remove image of target application(s)
docker image rm imageID
# Delete either dangling (unatagged images) docker containers or images or network
docker system prune -f
# Declare variable to target installation directory
target_install_dir='/usr/local/bin/docker-compose'
# Get OS and build (assumes Linux Centos7 and x86_64)
get_local_os_build=$(uname -s)-$(uname -m)
# Execute curl and sed command to carry out download and installation operation
# compose_latest_version=$(curl -L "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$get_local_os_build") -o $target_install_dir
# Use chmod to modify permissions to target installation directory (to make it executable)
chmod +x $target_install_dir
# Print docker-compose version to terminal to verify upgrade
$(docker-compose --version)
Edit the script with variables specific to your environment
The script above also has a few variables you need to edit with values specific to your docker environment. For instance, you need to replace container ID and image ID with the values that the following commands output.
docker ps
and
docker images output
Once you finalize creating the file (including the edits). Switch to the directory that contains the file. For example, if you created the file in /home/username/script/update_docker_compose.sh
cd /home/username/script
Last, run the script by executing the following
./update_docker_compose.sh
This is the method of installing docker compose version 2.12.x
Update debian package manager
# apt-get update
# apt-get install docker-compose-plugin
Then install the plugin manualy
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
Give permisson of execution of file
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
Last test the installation
docker compose version
// Docker Composer Version v2.12.2
If you have homebrew you can also install via brew
$ brew install docker-compose
This is a good way to install on a Mac OS system
Most of these solutions are outdated or make you install old version.
To install the latest
sudo apt install jq
DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Well, my case was pretty weird. I am using wsl2, and Docker Desktop (Windows 11). I stop getting this error after rename the folder "docker" to "config-dev-server" and update de Dockerfile like this this:
COPY ./docker/apache/apache2.conf /etc/apache2/apache2.conf
to
COPY ./config-dev-server/apache/apache2.conf /etc/apache2/apache2.conf
With a newer Docker Desktop for Mac 3.3.0, you don't need to install Docker Compose as a seperate package. Docker Compose comes as a first class citizen installed with Docker by default. Check out the below CLI:
docker compose version
Docker Compose version 2.0.0-beta.1%

How to make RPM not to overwrite files when installing new packages?

Engineer Engelbert, a fierce OpenSuSE 11-sp4 user, is in possession of two RPM packages with the same contents:
rpm -qlp ~/onemy_ls_0.0.1_x86_64.rpm | tee a
/.osc/_apiurl
/.osc/_files
/.osc/_meta
/.osc/_osclib_version
/.osc/_package
/.osc/_project
/my_ls/my_ls.sh
rpm -qlp ~/my_ls_0.0.1_x86_64.rpm | tee b
/.osc/_apiurl
/.osc/_files
/.osc/_meta
/.osc/_osclib_version
/.osc/_package
/.osc/_project
/my_ls/my_ls.sh
diff a b | wc
0 0 0
Engineer Engelbert has realized that he can install both packages with no warning from RPM:
rpm -e my_ls-0.0.1-1 ; rpm -i ~/my_ls_0.0.1_x86_64.rpm
rpm -e onemy_ls-0.0.1-1 ; rpm -i ~/onemy_ls_0.0.1_x86_64.rpm
Engineer Engelbert is self-assured about his choices. He knows that's probably a good design choice from rpm developers. So, he checked the man page, certain that there would be an option for not allowing rpm packages to overwrite files in the system. But all the install options he found were:
install-options
[--aid] [--allfiles] [--badreloc] [--excludepath OLDPATH]
[--excludedocs] [--force] [-h,--hash]
[--ignoresize] [--ignorearch] [--ignoreos]
[--includedocs] [--justdb] [--nodeps]
[--nodigest] [--nosignature] [--nosuggest]
[--noorder] [--noscripts] [--notriggers]
[--oldpackage] [--percent] [--prefix NEWPATH]
[--relocate OLDPATH=NEWPATH]
[--repackage] [--replacefiles] [--replacepkgs]
[--test]
He hesitated and found strange that there is --replacefiles, but not --keepfiles. That suggested him that keep would be the default behavior. So, he created an script:
rpm -e onemy_ls-0.0.1-1
rpm -e my_ls-0.0.1-1
rm -rf /my_ls/
rpm -i ~/my_ls_0.0.1_x86_64.rpm
ls -lh /my_ls -d
sleep 120
rpm -i ~/onemy_ls_0.0.1_x86_64.rpm
ls -lh /my_ls -d
That showed that the files were actually overwritten:
drwxr-xr-x 2 root root 4.0K Aug 16 17:07 /my_ls
drwxr-xr-x 2 root root 4.0K Aug 16 17:09 /my_ls
After a research, Engineer Engelbert couldn't still find the answer.Now he is in the middle of a flamewar about packaging systems, and, as asked by somebody, he needs your help:
How to make rpm not to overwrite files when installing new packages?
Note - Engineer Engelbert knows that he should create better rpm packages with conflicts management, you don't need to explain him that. He is mostly worried about being sure that his packages won't conflict with other proprietary unpublished packages racing for the same paths in the system.
Note - using fpm, you can regenerate Engineer Engelbert's RPMs:
mkdir -p first_pkg/my_ls/
echo ls > first_pkg/my_ls/my_ls.sh
fpm -s dir -t rpm -n onemy_ls -v 0.0.1 -C first_pkg/ -p onemy_ls_VERSION_ARCH.rpm
fpm -s dir -t rpm -n my_ls -v 0.0.1 -C first_pkg/ -p my_ls_VERSION_ARCH.rpm
Yes: rpm will overwrite all files contained in a *.rpm that are not marked with %config and there is no option to disable that behavior.

Which yum group(s) contain a given package?

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.
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.
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 ~]#