2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Merge pull request #2590 from neo954/go-xcat-devel

[go-xcat] Better Linux distro version detection
This commit is contained in:
yangsong 2017-03-03 15:57:59 +08:00 committed by GitHub
commit e51be9ccae

View File

@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.14
# Version 1.0.15
#
# Copyright (C) 2016 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
@ -370,7 +370,9 @@ function check_linux_version()
local ver="$(source /etc/os-release >/dev/null 2>&1 &&
echo "${VERSION_ID}")"
[[ -z "${ver}" && -f /etc/redhat-release ]] &&
ver="$(awk '{ print $(NF - 1) }' /etc/redhat-release)"
# Need gawk to do this trick
ver="$(awk '{ match($0, /([.0-9]+)/, a); print substr($0, a[1, "start"], a[1, "length"]); }' \
/etc/redhat-release)"
[[ -z "${ver}" && -f /etc/SuSE-release ]] &&
ver="$(awk '/VERSION/ { print $NF }' /etc/SuSE-release)"
echo "${ver}"