From f137257d3e12a3ae28cf55cd8ac6857269bf349f Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 28 Feb 2018 15:16:55 +0000 Subject: [PATCH] get-os.sh: Fix opensuse leap detection Signed-off-by: Jan Lindemann --- scripts/get-os.sh | 74 ++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/scripts/get-os.sh b/scripts/get-os.sh index 948a685e..00134dfe 100755 --- a/scripts/get-os.sh +++ b/scripts/get-os.sh @@ -44,43 +44,45 @@ cmd_name_version() . /etc/os-release if [ "$opt_verbose" ]; then echo $NAME $VERSION - else - if grep -qi tumbleweed /etc/os-release; then - echo suse-tumbleweed - else - if [ "$ID" != ubuntu ]; then - [ "$ID_LIKE" ] && ID=$ID_LIKE - fi - case "$ID" in - debian) - VERSION_NAME=`echo $PRETTY_NAME | awk 'NF>1{print $NF}' | sed 's%/.*%%' | tr '[A-Z]' '[a-z]'` - case $VERSION_NAME in - buster) VERSION_ID=10;; - stretch) VERSION_ID=9;; - jessie) VERSION_ID=8;; - wheezy) VERSION_ID=7;; - squeeze) VERSION_ID=6.0;; - lenny) VERSION_ID=5.0;; - etch) VERSION_ID=4.0;; - sarge) VERSION_ID=3.1;; - woody) VERSION_ID=3.0;; - potato) VERSION_ID=2.2;; - slink) VERSION_ID=2.1;; - hamm) VERSION_ID=2.0;; - *) - ;; - esac - ;; - ubuntu) - ;; - *) - VERSION_ID=42 - ;; - esac - echo $ID-$VERSION_ID | sed 's/opensuse/suse/g' - fi + exit 0 fi - exit + if grep -qi tumbleweed /etc/os-release; then + echo suse-tumbleweed + exit 0 + fi + if [ "$ID" != ubuntu ]; then + [ "$ID_LIKE" ] && ID=$ID_LIKE + fi + case "$ID" in + debian) + VERSION_NAME=`echo $PRETTY_NAME | awk 'NF>1{print $NF}' | sed 's%/.*%%' | tr '[A-Z]' '[a-z]'` + case $VERSION_NAME in + buster) VERSION_ID=10;; + stretch) VERSION_ID=9;; + jessie) VERSION_ID=8;; + wheezy) VERSION_ID=7;; + squeeze) VERSION_ID=6.0;; + lenny) VERSION_ID=5.0;; + etch) VERSION_ID=4.0;; + sarge) VERSION_ID=3.1;; + woody) VERSION_ID=3.0;; + potato) VERSION_ID=2.2;; + slink) VERSION_ID=2.1;; + hamm) VERSION_ID=2.0;; + *) + ;; + esac + ;; + ubuntu) + ;; + suse|opensuse) + ;; + *) + VERSION_ID=42 + ;; + esac + echo $ID-$VERSION_ID | sed 's/opensuse/suse/g' + exit 0 fi if [ -e /etc/SuSE-release ]; then