Created
May 12, 2017 18:03
-
-
Save halcyondude/bba86f48f2738f51ab45dc8726a336e1 to your computer and use it in GitHub Desktop.
get a detailed list of all packages installed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# dump detailed repository and (s)rpm info --> /tmp | |
set -x | |
# TODO: make output directory a jinja param, so that we can do this for various images (base, ipa, overcloud, undercloud) | |
outdir="./out" | |
yum repolist -v | tee repostats-repolist.txt | |
# https://bugzilla.redhat.com/show_bug.cgi?id=584525 yum (when no tty) is hard coded to 80 cols because bug | |
# | |
# get a list of all packages in parsable format | |
# virt-install.noarch 1.4.1-2.fc25 @updates | |
yum list installed -q | tr "\n" "#" | sed -e 's/# / /g' | tr "#" "\n" | awk '{printf "%-60s %-60s %s\n", $1, $2, $3}' | tee $outdir/repostats-installed.txt | |
# lines start with *, Loaded, Loading, and end with 'repolist: <number>'| get the first col | get rid of arch if present | |
repo_list=`yum repolist -q | tail -n +2 | awk '{print $1;}' | awk '{split($0, a, "/"); print a[1];}'` | |
echo $repo_list | |
for i in $repo_list; do | |
# get a list of all packages in the repo, this requires sudo | |
echo sudo yum repository-packages $i list -q | tr "\n" "#" | sed -e 's/# / /g' | tr "#" "\n" | awk '{printf "%-60s %-60s %s\n", $1, $2, $3}' | tee $outdir/repostats-list_$i.txt | |
# get source info | |
echo repoquery --plugins --disablerepo='' --enablerepo=\'$i\' -a --qf '%{sourcerpm}'|sort -u|sed 's/.src.rpm//g' | tee $outdir/repostats_srckey_$i.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment