diff options
author | min li <min.li1@citrix.com> | 2019-01-11 10:35:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 10:35:33 +0800 |
commit | d274789331048c4e6b1d3880e9b7114f522ba1b0 (patch) | |
tree | b98e637973bc4b0921cd7544eb4c5cb449b553af | |
parent | 1ea5634256b9a30dde3f86bfce08e4269899b884 (diff) | |
parent | fedb8302d893b5535b2746b3d7b3c3b0def093a5 (diff) | |
download | vyos-xe-guest-utilities-d274789331048c4e6b1d3880e9b7114f522ba1b0.tar.gz vyos-xe-guest-utilities-d274789331048c4e6b1d3880e9b7114f522ba1b0.zip |
Merge pull request #59 from lln133208/feature/REQ-708/masterv7.11.0
CP-30014: Add support for SUSE enterprise Linux 15 (#4)
-rw-r--r-- | mk/testcases/sle-15 | 8 | ||||
-rwxr-xr-x | mk/xe-linux-distribution | 33 | ||||
-rwxr-xr-x | mk/xe-linux-distribution-test | 4 |
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 |