Updated detect script

This commit is contained in:
2019-11-07 17:29:27 -06:00
parent 77c6cd53f3
commit 7375995b7e

View File

@@ -10,7 +10,7 @@ resetDistVer() {
if [ -f /etc/centos-release ]; then if [ -f /etc/centos-release ]; then
. /etc/os-release . /etc/os-release
if [ "$VERSION_ID" == "7" ]; then if [ "$VERSION_ID" = "7" ]; then
DISTNAME=centos DISTNAME=centos
DISTVER=7 DISTVER=7
else else
@@ -18,13 +18,13 @@ if [ -f /etc/centos-release ]; then
fi fi
elif [ -f /etc/fedora-release ]; then elif [ -f /etc/fedora-release ]; then
. /etc/os-release . /etc/os-release
if [ "$VERSION_ID" == "30" ]; then if [ "$VERSION_ID" = "30" ]; then
DISTNAME=fedora DISTNAME=fedora
DISTVER=30 DISTVER=30
elif [ "$VERSION_ID" == "29" ]; then elif [ "$VERSION_ID" = "29" ]; then
DISTNAME=fedora DISTNAME=fedora
DISTVER=29 DISTVER=29
elif [ "$VERSION_ID" == "28" ]; then elif [ "$VERSION_ID" = "28" ]; then
DISTNAME=fedora DISTNAME=fedora
DISTVER=28 DISTVER=28
else else
@@ -38,7 +38,7 @@ elif [ -f /etc/lsb-release ]; then
DISTVER=${DISTRIB_RELEASE} DISTVER=${DISTRIB_RELEASE}
if [ "$DISTNAME" != "ubuntu" ]; then if [ "$DISTNAME" != "ubuntu" ]; then
if [ "$DISTNAME" = "linuxmint" ]; then if [ "$DISTNAME" = "linuxmint" ]; then
if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ]; then if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ] || [ "$DISTVER" = "19.2" ]; then
DISTNAME=ubuntu DISTNAME=ubuntu
DISTVER=18.04 DISTVER=18.04
else else
@@ -54,36 +54,38 @@ elif [ -f /etc/lsb-release ]; then
else else
resetDistVer resetDistVer
fi fi
elif [ "$DISTVER" != "18.04" ] && [ "$DISTVER" != "18.10" ] && [ "$DISTVER" != "19.04" ] && [ "$DISTVER" != "19.10" ]; then
resetDistVer
fi fi
elif [ -f /etc/debian_version ]; then fi
if [ "$DISTNAME" = "unknown" ] && [ -f /etc/debian_version ]; then
DISTNAME=debian DISTNAME=debian
DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}') DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}')
if [ "$DISTVER" != "9" ]; then if [ "$DISTVER" != "9" ] && [ "$DISTVER" != "10" ]; then
if [ "$DISTVER" != "10" ]; then resetDistVer
resetDistVer
fi
fi fi
fi fi
if [ "$DISTNAME" == "unknown" ]; then if [ "$DISTNAME" = "unknown" ]; then
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
. /etc/os-release . /etc/os-release
if [ "$ID" == "arch" ]; then if [ "$ID" = "arch" ]; then
DISTNAME=arch DISTNAME=arch
elif [ "$ID" == "antergos" ] || [ "$ID" == "manjaro" ]; then elif [ "$ID" = "antergos" ] || [ "$ID" = "manjaro" ]; then
DISTNAME=ubuntu DISTNAME=ubuntu
DISTVER=18.10 DISTVER=18.10
elif [ "$ID" == "opensuse-leap" ]; then elif [ "$ID" = "opensuse-leap" ]; then
if [ "$VERSION_ID" == "15.0" ]; then if [ "$VERSION_ID" = "15.0" ]; then
DISTNAME=opensuse DISTNAME=opensuse
DISTVER=15 DISTVER=15
elif [ "$VERSION_ID" == "15.1" ]; then elif [ "$VERSION_ID" = "15.1" ]; then
DISTNAME=opensuse DISTNAME=opensuse
DISTVER=15.1 DISTVER=15.1
else else
resetDistVer resetDistVer
fi fi
elif [ "$ID" == "opensuse-tumbleweed" ]; then elif [ "$ID" = "opensuse-tumbleweed" ]; then
DISTNAME=tumbleweed DISTNAME=tumbleweed
DISTVER= DISTVER=
else else
@@ -94,4 +96,4 @@ if [ "$DISTNAME" == "unknown" ]; then
fi fi
fi fi
echo ${DISTNAME}${DISTVER} echo ${DISTNAME}${DISTVER}