mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
get detailed info of installed RPM packages
for rpm-based distros
This commit is contained in:
parent
cef2e6fb51
commit
6d3193f962
@ -1,58 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# for RPM-based distros
|
||||||
|
# get detailed installed-packages info
|
||||||
|
|
||||||
echo "Getting sorted list of installed pkgs..."
|
echo "Getting sorted list of installed pkgs..."
|
||||||
date
|
date
|
||||||
|
|
||||||
rpm -qa |sort >~/Installedpkgs.list
|
time rpm -qa |sort >~/Installedpkgs.list
|
||||||
echo EOF>>~/Installedpkgs.list
|
#echo EOF>>~/Installedpkgs.list
|
||||||
|
|
||||||
echo "Done with sort"
|
echo "$(date) - Done with sort"
|
||||||
date
|
|
||||||
|
|
||||||
let tr=1
|
|
||||||
let thisline=0
|
|
||||||
|
|
||||||
echo "Reading sorted list into array..."
|
|
||||||
{
|
|
||||||
while read elemt; do
|
|
||||||
let thisline=$thisline+1
|
|
||||||
|
|
||||||
# Skip comments
|
|
||||||
commentmp=`(echo $elemt |grep -c -e "\#")`
|
|
||||||
test4blank=${elemt//" "/""}
|
|
||||||
|
|
||||||
if [ $commentmp -gt 0 ]; then
|
|
||||||
echo "Found a comment in line "$thisline". Skipping."
|
|
||||||
elif [ ${#test4blank} -eq 0 ]; then
|
|
||||||
echo "Blank line at "$thisline". Skipping."
|
|
||||||
elif [ "$elemt" = "EOF" ]; then
|
|
||||||
echo "EOF found in line "$thisline"."
|
|
||||||
break
|
|
||||||
else
|
|
||||||
riptrack[$tr]=$elemt
|
|
||||||
let tr=$tr+1
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
} < ~/Installedpkgs.list
|
|
||||||
echo "Done with array = "$tr" elements."
|
|
||||||
date
|
|
||||||
|
|
||||||
# Repeat array
|
|
||||||
#for i in "${riptrack[@]}"; do
|
|
||||||
# echo $i
|
|
||||||
#done
|
|
||||||
|
|
||||||
# Blank it
|
# Blank it
|
||||||
>~/RPMInstalled.list
|
outfile=~/RPMInstalled.list.txt
|
||||||
|
> $outfile
|
||||||
|
|
||||||
echo "Querying all installed pkgs for details..."
|
echo "Querying all installed pkgs for details..."
|
||||||
# Do it
|
# Do it
|
||||||
for i in "${riptrack[@]}"; do
|
for i in $(cat ~/Installedpkgs.list); do
|
||||||
rpm -qi $i >>~/RPMInstalled.list
|
rpm -qi $i >>$outfile
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Done- PK"
|
echo "$(date) - Done"
|
||||||
date
|
|
||||||
#read
|
|
||||||
#less ~/RPMInstalled.list
|
#less ~/RPMInstalled.list
|
||||||
|
ls -alh $outfile
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
|
# 2021.0408 rewrite simpler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user