mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
scripts: fix kvm host undefined version (#7179)
On Oracle Linux 9.0, version shows as undefined and even Host.OS shows as "Red". This change fixes the script to use '/etc/os-release' ins such cases. Signed-off-by: Abhishek Kumar <abhishek.kumar@shapeblue.com>
This commit is contained in:
parent
3b67be2d52
commit
e61ab3d6e9
@ -29,18 +29,33 @@ DIST="Unknown Linux"
|
||||
REV="X.Y"
|
||||
CODENAME=""
|
||||
|
||||
if [ -f /etc/redhat-release ] ; then
|
||||
function get_from_redhat_release {
|
||||
DIST=`cat /etc/redhat-release | awk '{print $1}'`
|
||||
CODENAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
||||
REV=`cat /etc/redhat-release | awk '{print $3,$4}' | grep -o "[0-9.]*"`
|
||||
elif [ -f /etc/lsb-release ] ; then
|
||||
}
|
||||
|
||||
function get_from_lsb_release {
|
||||
DIST=`cat /etc/lsb-release | grep DISTRIB_ID | tr "\n" ' '| sed s/.*=//`
|
||||
REV=`cat /etc/lsb-release | grep DISTRIB_RELEASE | tr "\n" ' '| sed s/.*=//`
|
||||
CODENAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | tr "\n" ' '| sed s/.*=//`
|
||||
elif [ -f /etc/os-release ] ; then
|
||||
}
|
||||
|
||||
function get_from_os_release {
|
||||
DIST=`grep -e "^NAME=" /etc/os-release | awk -F\" '{print $2}'`
|
||||
REV=`grep -e "^VERSION_ID=" /etc/os-release | awk -F\" '{print $2}'`
|
||||
CODENAME=`grep -e "^PRETTY_NAME=" /etc/os-release | awk -F\" '{print $2}'`
|
||||
}
|
||||
|
||||
if [ -f /etc/redhat-release ] ; then
|
||||
get_from_redhat_release
|
||||
if [ -z "$REV" ] && [ -f /etc/os-release ]; then
|
||||
get_from_os_release
|
||||
fi
|
||||
elif [ -f /etc/lsb-release ] ; then
|
||||
get_from_lsb_release
|
||||
elif [ -f /etc/os-release ] ; then
|
||||
get_from_os_release
|
||||
fi
|
||||
|
||||
echo Host.OS=${DIST}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user