summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-01-23 12:24:04 -0800
committerhagbard <vyosdev@derith.de>2019-01-23 12:24:04 -0800
commit20c22a53650f7d77fb68573381b1a26f802054b1 (patch)
tree54dbebc1b95079bf1aedbfa7437c88363eb109d2
parentf720a86bb30b96733f24a70249f0ee586c29b1ca (diff)
parentd274789331048c4e6b1d3880e9b7114f522ba1b0 (diff)
downloadvyos-xe-guest-utilities-20c22a53650f7d77fb68573381b1a26f802054b1.tar.gz
vyos-xe-guest-utilities-20c22a53650f7d77fb68573381b1a26f802054b1.zip
Merge remote-tracking branch 'upstream/master' into current
https://github.com/xenserver/xe-guest-utilities
-rw-r--r--mk/testcases/sle-158
-rwxr-xr-xmk/xe-linux-distribution33
-rwxr-xr-xmk/xe-linux-distribution-test4
3 files changed, 34 insertions, 11 deletions
diff --git a/mk/testcases/sle-15 b/mk/testcases/sle-15
new file mode 100644
index 0000000..d06c32f
--- /dev/null
+++ b/mk/testcases/sle-15
@@ -0,0 +1,8 @@
+NAME="SLES"
+VERSION="15"
+VERSION_ID="15"
+PRETTY_NAME="SUSE Linux Enterprise Server 15"
+ID="sles"
+ID_LIKE="suse"
+ANSI_COLOR="0;32"
+CPE_NAME="cpe:/o:suse:sles:15"
diff --git a/mk/xe-linux-distribution b/mk/xe-linux-distribution
index b10d343..a5f1b2a 100755
--- a/mk/xe-linux-distribution
+++ b/mk/xe-linux-distribution
@@ -47,6 +47,7 @@ write_to_output()
MINOR=$minor
DISTRO=$distro
UNAME=$uname
+ NAME=$name
return 0
fi
@@ -205,21 +206,33 @@ identify_sles()
# SUSE Linux Enterprise Server 11 (i586)
# VERSION = 11
# PATCHLEVEL = 0
+ #
+ # /etc/SuSE-release is deprecated and removed in SLE15, so use /etc/os-release to detect.
+ # NAME="SLES"
+ # VERSION="15"
+ # VERSION_ID="15"
+ # PRETTY_NAME="SUSE Linux Enterprise Server 15"
+ # ID="sles"
+ # ID_LIKE="suse"
+ # ANSI_COLOR="0;32"
+ # CPE_NAME="cpe:/o:suse:sles:15"
if [ ! -f "${suse_release}" ] ; then
return 1
fi
eval $(sed -n \
- -e 's/^SUSE L\(inux\|INUX\) Enterprise \([a-zA-Z0-9_]*\) \([0-9]*\) (.*)/_major=\3;/gp;' \
+ -e 's/^SUSE L\(inux\|INUX\) Enterprise \([a-zA-Z0-9_]*\) \([0-9]*\) (.*)/_major=\3;_pretty_name="\0";/gp;' \
-e 's/^VERSION = \([0-9]*\)$/major=\1;/gp;' \
-e 's/^PATCHLEVEL = \([0-9]*\)$/minor=\1;/gp;' \
- "${suse_release}")
+ -e 's/^PRETTY_NAME="SUSE L\(inux\|INUX\) Enterprise \([a-zA-Z0-9_]*\) \([0-9]*\)"/_major=\3;_pretty_name=\0;/gp' \
+ -e 's/^VERSION="\([0-9]*\)"$/major=\1;/gp' \
+ "${suse_release}")
if [ -z "${major}" -o -z "${_major}" ] ; then
return 1
fi
-
+
if [ "${major}" != "${_major}" ] ; then
return 1
fi
@@ -228,8 +241,7 @@ identify_sles()
minor=0
fi
- write_to_output "sles" "${major}" "${minor}" "$(head -n 1 ${suse_release})"
-
+ write_to_output "sles" "${major}" "${minor}" "${_pretty_name##*=}"
}
identify_lsb()
@@ -463,14 +475,17 @@ if [ -z "${TEST}" ] ; then
identify_redhat /etc/enterprise-release && exit 0
identify_redhat /etc/centos-release && exit 0
identify_redhat /etc/redhat-release && exit 0
- identify_sles /etc/SuSE-release && exit 0
+ #identify SuSE-release before, as previous version of SUSE or other distros also have os-release
+ identify_sles /etc/SuSE-release && exit 0
+ identify_sles /etc/os-release && exit 0
#identify Linx disto before debian, as Linx has both linx_release and debian_version.
- identify_yinhe /etc/kylin-build && exit 0
- identify_linx /etc/linx-release && exit 0
- identify_lsb lsb_release && exit 0
+ identify_yinhe /etc/kylin-build && exit 0
+ identify_linx /etc/linx-release && exit 0
+ identify_lsb lsb_release && exit 0
identify_debian /etc/debian_version && exit 0
identify_boot2docker /etc/boot2docker && exit 0
+
if [ $# -eq 1 ] ; then
rm -f "$1"
fi
diff --git a/mk/xe-linux-distribution-test b/mk/xe-linux-distribution-test
index 1d6dfcf..51c800a 100755
--- a/mk/xe-linux-distribution-test
+++ b/mk/xe-linux-distribution-test
@@ -39,7 +39,7 @@ do_test()
echo "FAILED: ${TC} $1 $2.$3: minor ${MINOR} != $3" 1>&2
exit 1
fi
- echo "PASSED: ${TC}: ${DISTRO} ${MAJOR} ${MINOR} correctly detected" 1>&2
+ echo "PASSED: ${TC}: ${DISTRO} ${MAJOR} ${MINOR} ${NAME} correctly detected" 1>&2
fi
else
if [ X"${TEST_RESULT}" = X"FAIL" ] ; then
@@ -78,5 +78,5 @@ do_test "testcases/lsb-ubuntu-7.04" "ubuntu 7 04"
do_test "testcases/oracle-5" "oracle 5 0"
do_test "testcases/oracle-5u1" "oracle 5 1"
do_test "testcases/lsb-coreos-367.1.0" "coreos 367 1.0"
-
+do_test "testcases/sle-15" "sles 15 0"
exit 0