From 7375995b7e35917c7fc4c27bc090393cf91857c3 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 7 Nov 2019 17:29:27 -0600 Subject: [PATCH] Updated detect script --- public/detect_linux.sh | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/public/detect_linux.sh b/public/detect_linux.sh index 0e6fe5e..dff2bd4 100644 --- a/public/detect_linux.sh +++ b/public/detect_linux.sh @@ -10,7 +10,7 @@ resetDistVer() { if [ -f /etc/centos-release ]; then . /etc/os-release - if [ "$VERSION_ID" == "7" ]; then + if [ "$VERSION_ID" = "7" ]; then DISTNAME=centos DISTVER=7 else @@ -18,13 +18,13 @@ if [ -f /etc/centos-release ]; then fi elif [ -f /etc/fedora-release ]; then . /etc/os-release - if [ "$VERSION_ID" == "30" ]; then + if [ "$VERSION_ID" = "30" ]; then DISTNAME=fedora DISTVER=30 - elif [ "$VERSION_ID" == "29" ]; then + elif [ "$VERSION_ID" = "29" ]; then DISTNAME=fedora DISTVER=29 - elif [ "$VERSION_ID" == "28" ]; then + elif [ "$VERSION_ID" = "28" ]; then DISTNAME=fedora DISTVER=28 else @@ -38,7 +38,7 @@ elif [ -f /etc/lsb-release ]; then DISTVER=${DISTRIB_RELEASE} if [ "$DISTNAME" != "ubuntu" ]; then if [ "$DISTNAME" = "linuxmint" ]; then - if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ]; then + if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ] || [ "$DISTVER" = "19.2" ]; then DISTNAME=ubuntu DISTVER=18.04 else @@ -54,36 +54,38 @@ elif [ -f /etc/lsb-release ]; then else resetDistVer fi + elif [ "$DISTVER" != "18.04" ] && [ "$DISTVER" != "18.10" ] && [ "$DISTVER" != "19.04" ] && [ "$DISTVER" != "19.10" ]; then + resetDistVer fi -elif [ -f /etc/debian_version ]; then +fi + +if [ "$DISTNAME" = "unknown" ] && [ -f /etc/debian_version ]; then DISTNAME=debian DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}') - if [ "$DISTVER" != "9" ]; then - if [ "$DISTVER" != "10" ]; then - resetDistVer - fi + if [ "$DISTVER" != "9" ] && [ "$DISTVER" != "10" ]; then + resetDistVer fi -fi +fi -if [ "$DISTNAME" == "unknown" ]; then +if [ "$DISTNAME" = "unknown" ]; then if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" == "arch" ]; then + if [ "$ID" = "arch" ]; then DISTNAME=arch - elif [ "$ID" == "antergos" ] || [ "$ID" == "manjaro" ]; then + elif [ "$ID" = "antergos" ] || [ "$ID" = "manjaro" ]; then DISTNAME=ubuntu DISTVER=18.10 - elif [ "$ID" == "opensuse-leap" ]; then - if [ "$VERSION_ID" == "15.0" ]; then + elif [ "$ID" = "opensuse-leap" ]; then + if [ "$VERSION_ID" = "15.0" ]; then DISTNAME=opensuse DISTVER=15 - elif [ "$VERSION_ID" == "15.1" ]; then + elif [ "$VERSION_ID" = "15.1" ]; then DISTNAME=opensuse DISTVER=15.1 else resetDistVer fi - elif [ "$ID" == "opensuse-tumbleweed" ]; then + elif [ "$ID" = "opensuse-tumbleweed" ]; then DISTNAME=tumbleweed DISTVER= else @@ -94,4 +96,4 @@ if [ "$DISTNAME" == "unknown" ]; then fi fi -echo ${DISTNAME}${DISTVER} \ No newline at end of file +echo ${DISTNAME}${DISTVER}