Add XenServer to GetDistro's logic

This is primarily to satisfy the expectations of various scripts that os_*
variables are defined, and will result in a distro similar to "xs6.1.0-59235p"

Fixes bug 1211001

Change-Id: I951e1eb3a5e25f4d8773a11b15cf38157b6492fe
This commit is contained in:
Bob Ball 2013-08-12 17:28:50 +01:00
parent da2b6785fc
commit 4669122dc8
2 changed files with 8 additions and 1 deletions

View File

@ -387,8 +387,9 @@ GetOSVersion() {
# CentOS release 5.5 (Final) # CentOS release 5.5 (Final)
# CentOS Linux release 6.0 (Final) # CentOS Linux release 6.0 (Final)
# Fedora release 16 (Verne) # Fedora release 16 (Verne)
# XenServer release 6.2.0-70446c (xenenterprise)
os_CODENAME="" os_CODENAME=""
for r in "Red Hat" CentOS Fedora; do for r in "Red Hat" CentOS Fedora XenServer; do
os_VENDOR=$r os_VENDOR=$r
if [[ -n "`grep \"$r\" /etc/redhat-release`" ]]; then if [[ -n "`grep \"$r\" /etc/redhat-release`" ]]; then
ver=`sed -e 's/^.* \(.*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release` ver=`sed -e 's/^.* \(.*\) (\(.*\)).*$/\1\|\2/' /etc/redhat-release`
@ -451,6 +452,8 @@ function GetDistro() {
elif [[ "$os_VENDOR" =~ (Red Hat) || "$os_VENDOR" =~ (CentOS) ]]; then elif [[ "$os_VENDOR" =~ (Red Hat) || "$os_VENDOR" =~ (CentOS) ]]; then
# Drop the . release as we assume it's compatible # Drop the . release as we assume it's compatible
DISTRO="rhel${os_RELEASE::1}" DISTRO="rhel${os_RELEASE::1}"
elif [[ "$os_VENDOR" =~ (XenServer) ]]; then
DISTRO="xs$os_RELEASE"
else else
# Catch-all for now is Vendor + Release + Update # Catch-all for now is Vendor + Release + Update
DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE" DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE"

View File

@ -29,6 +29,10 @@ THIS_DIR=$(cd $(dirname "$0") && pwd)
# xapi functions # xapi functions
. $THIS_DIR/functions . $THIS_DIR/functions
# Determine what system we are running on.
# Might not be XenServer if we're using xenserver-core
GetDistro
# #
# Get Settings # Get Settings
# #