Added script for generating a CSV file of CT/VM Guests

This commit is contained in:
2023-11-19 22:59:38 +01:00
parent 2d760c856d
commit cf0e4928ca
3 changed files with 63 additions and 1 deletions

View File

@@ -208,4 +208,20 @@ UpgradeRelease () {
echo "Warning: Release upgrade are supported for this distro"
#exit 100
fi
}
ParseOSRelease()
{
if [ ! -z "$OSRELEASE" ]; then
DISTRO=$(printf "$OSRELEASE" | awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)
VERSION=$(printf "$OSRELEASE" | awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release |tr -d '"' )
VERSIONNAME=$(printf "$OSRELEASE" | -- awk -F= '$1=="VERSION_CODENAME" { print $2 ;}' /etc/os-release)
if [ ! -z "$VERSIONNAME" ]; then
VERSION="$VERSION ($VERSIONNAME)"
fi
else
DISTRO=N/A
VERSION=N/A
fi
echo "$TYPE,$ID,$NAME,$STATUS,$DISTRO,$VERSION" | tee -a $InventoryFile
}