mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
get full descriptions of installed RPM packages
for rpm-based distros
This commit is contained in:
parent
79fee315d4
commit
cef2e6fb51
58
rpmsortinst.sh
Normal file
58
rpmsortinst.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Getting sorted list of installed pkgs..."
|
||||
date
|
||||
|
||||
rpm -qa |sort >~/Installedpkgs.list
|
||||
echo EOF>>~/Installedpkgs.list
|
||||
|
||||
echo "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
|
||||
>~/RPMInstalled.list
|
||||
|
||||
echo "Querying all installed pkgs for details..."
|
||||
# Do it
|
||||
for i in "${riptrack[@]}"; do
|
||||
rpm -qi $i >>~/RPMInstalled.list
|
||||
done
|
||||
|
||||
echo "Done- PK"
|
||||
date
|
||||
#read
|
||||
#less ~/RPMInstalled.list
|
Loading…
x
Reference in New Issue
Block a user