Skip to content

Commit

Permalink
Merge pull request #289 from simaishi/rpm_manifest
Browse files Browse the repository at this point in the history
Add a script to generate rpm manifest
  • Loading branch information
bdunne authored Jun 30, 2020
2 parents 9c5126f + e9c92cc commit ce70659
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions LINK/usr/bin/generate_rpm_manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

manifest_dir=$APPLIANCE_SOURCE_DIRECTORY/../manifest
mkdir -p $manifest_dir

pushd $manifest_dir
manifest=rpm_manifest_$(date +"%m%d%y").csv

# dnf command gives yum repo used to install rpm
dnf list --installed | tr -s " " | while read name_arch version license
do
if [[ "$name_arch" == "Installed" ]]; then continue; fi
IFS=. read name arch <<< $name_arch
echo -e "$name\t$version\t$license" >> dnf_list
done
sort -o dnf_list dnf_list

# rpm command gives rpm license info
rpm -qa --qf '%{name}\t%{version}-%{release}.%{arch}\t"%{license}"\n' |sort > rpm_list
sed -i '/^gpg-pubkey/d' rpm_list

echo "name,version,license,repo" > $manifest
join -j 1 -o 1.1,1.2,1.3,2.3 -t $'\t' -a 1 rpm_list dnf_list >> $manifest
sed -i 's/\t/,/g' $manifest
rm -f rpm_list dnf_list
popd

0 comments on commit ce70659

Please sign in to comment.