From: Uwe Köcher Date: Fri, 22 Jan 2021 22:38:49 +0000 (+0100) Subject: guess_platform: find major os version X-Git-Tag: v9.3.0-r3~28^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0da61bf54a681133fe083b406c034c988a3b0b95;p=candi.git guess_platform: find major os version --- diff --git a/candi.sh b/candi.sh index c08afe5..83eed8c 100755 --- a/candi.sh +++ b/candi.sh @@ -575,6 +575,7 @@ guess_platform() { elif [ -f /etc/os-release ]; then local OS_ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') local OS_VERSIONID=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"') + local OS_MAJOR_VER=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"' | grep -oE '[0-9]+' | head -n 1) local OS_NAME=$(grep -oP '(?<=^NAME=).+' /etc/os-release | tr -d '"') local OS_PRETTY_NAME=$(grep -oP '(?<=^PRETTY_NAME=).+' /etc/os-release | tr -d '"') @@ -585,13 +586,13 @@ guess_platform() { echo centos${OS_VERSIONID} elif [ "$OS_ID" == "rhel" ]; then - echo rhel${OS_VERSIONID} + echo rhel${OS_MAJOR_VER} elif [ "$OS_ID" == "debian" ]; then echo debian${OS_VERSIONID} elif [ "$OS_ID" == "ubuntu" ]; then - echo ubuntu${OS_VERSIONID} + echo ubuntu${OS_MAJOR_VER} elif [ "$OS_ID" == "opensuse" ]; then if [ "${OS_NAME}" == "openSUSE Leap" ]; then