From 1759d72d9f32ce8df8cbe003a8140a60ae189743 Mon Sep 17 00:00:00 2001 From: Minh Diep Date: Wed, 8 Apr 2015 13:38:41 -0700 Subject: [PATCH] LU-6445 test: display test distribution accurately Each Linux distribution has different file and format We will read from less common /etc/SuSE-release for SUSE /etc/os-release for Ubuntu, and EL6.6/EL7 /etc/system-release for EL6.5./EL6.6/EL7 Signed-off-by: Minh Diep Change-Id: I1a4fb8418aca303ea0dbe603e58fbfa916b8e20b Reviewed-on: http://review.whamcloud.com/14409 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/yaml.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lustre/tests/yaml.sh b/lustre/tests/yaml.sh index 1fcf3ce..202fed3 100644 --- a/lustre/tests/yaml.sh +++ b/lustre/tests/yaml.sh @@ -73,13 +73,23 @@ yml_code_review() { } release() { - if [ -r /etc/lsb-release ]; then - dist=$(sed -ne '/^DISTRIB_ID/s/DISTRIB_ID=//p' /etc/lsb-release) - elif [ -r /etc/redhat-release ]; then - dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3) }' \ - /etc/redhat-release) + if [ -r /etc/SuSE-release ]; then + name=$(awk '/SUSE/ { printf("%s %s %s %s", $1, $2, $3, $4) }' \ + /etc/SuSE-release) + version=$(sed -n -e 's/^VERSION = //p' /etc/SuSE-release) + level=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release) + dist="${name} ${version}.${level}" + elif [ -r /etc/os-release ]; then + name=$(sed -n -e 's/"//g' -e 's/^NAME=//p' /etc/os-release) + version=$(sed -n -e 's/"//g' -e 's/^VERSION_ID=//p' \ + /etc/os-release) + dist="${name} ${version}" + elif [ -r /etc/system-release ]; then + dist=$(awk '/release/ \ + { printf("%s %s %s", $1, $2, $3) }' \ + /etc/system-release) elif [ -r /etc/*-release ]; then - dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | + dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | \ sed -e 's/\/etc\///' -e 's/-release//' | head -n1) else dist="UNKNOWN" -- 1.8.3.1