Split name and version information for RPM based package manager

This commit is contained in:
mboelen 2015-12-21 19:10:22 +01:00
parent 6815c9a915
commit 360e6b66f6
1 changed files with 4 additions and 2 deletions

View File

@ -137,7 +137,7 @@
logtext "Test: Querying 'rpm -qa' to get package list"
Display --indent 6 --text "- Querying RPM package manager"
logtext "Output:"; logtext "--------"
SPACKAGES=`${RPMBINARY} -qa 2> /dev/null | sort`
SPACKAGES=`${RPMBINARY} -qa --query "%{NAME},%{VERSION}-%{RELEASE}.%{ARCH}\n" 2> /dev/null | sort`
if [ "${SPACKAGES}" = "" ]; then
logtext "Result: RPM binary available, but package list seems to be empty"
logtext "Info: looks like the rpm binary is installed, but not used for package installation"
@ -145,8 +145,10 @@
else
for J in ${SPACKAGES}; do
N=`expr ${N} + 1`
PACKAGE_NAME=`echo ${J} | awk -F, '{print $1}'`
PACKAGE_VERSION=`echo ${J} | awk -F, '{print $2}'`
logtext "Found package: ${J}"
INSTALLED_PACKAGES="${INSTALLED_PACKAGES}|${J},0,"
INSTALLED_PACKAGES="${INSTALLED_PACKAGES}|${PACKAGE_NAME},${PACKAGE_VERSION},"
done
report "installed_packages=${N}"
fi