]> https://gitweb.dealii.org/ - candi.git/commitdiff
guess_platform: find major os version
authorUwe Köcher <mail@uwe.koecher.cc>
Fri, 22 Jan 2021 22:38:49 +0000 (23:38 +0100)
committerUwe Köcher <mail@uwe.koecher.cc>
Fri, 22 Jan 2021 22:38:49 +0000 (23:38 +0100)
candi.sh

index c08afe55a11cc987beb4af893d41750192c7afc3..83eed8c98a5d38830b223b06c4935b41c18ce589 100755 (executable)
--- 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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.