PKGS-7303: Added version numbers to brew packages.

This allows lynis enterprise to render the software  packages in the webinterface.
This commit is contained in:
Florian Sonnenschein 2024-03-11 12:14:31 +01:00
parent d733780777
commit 126b8053aa
1 changed files with 9 additions and 5 deletions

View File

@ -127,11 +127,15 @@
LogText "Test: Querying brew to get package list" LogText "Test: Querying brew to get package list"
Display --indent 4 --text "- Querying brew for installed packages" Display --indent 4 --text "- Querying brew for installed packages"
LogText "Output:"; LogText "-----" LogText "Output:"; LogText "-----"
GPACKAGES=$(brew list) GPACKAGES=$(brew list --versions)
for J in ${GPACKAGES}; do while IFS= read -r PKG; do
LogText "Found package ${J}" PACKAGE_NAME=$(echo ${PKG} | ${CUTBINARY} -d ' ' -f1)
INSTALLED_PACKAGES="${INSTALLED_PACKAGES}|${J}" PACKAGE_VERSION=$(echo ${PKG} | ${CUTBINARY} -d ' ' -f2)
done LogText "Found package: ${PACKAGE_NAME} (version: ${PACKAGE_VERSION})"
INSTALLED_PACKAGES="${INSTALLED_PACKAGES}|${PACKAGE_NAME},${PACKAGE_VERSION}"
done << EOF
$GPACKAGES
EOF
else else
LogText "Result: brew can NOT be found on this system" LogText "Result: brew can NOT be found on this system"
fi fi