From 74c74905753138fb9bb527cd86fee3fef05bdd40 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 18 Apr 2019 21:36:42 -0500 Subject: [PATCH] Fix detection --- public/detect_linux.sh | 57 +++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/public/detect_linux.sh b/public/detect_linux.sh index 2944208..8ff413a 100644 --- a/public/detect_linux.sh +++ b/public/detect_linux.sh @@ -2,8 +2,32 @@ DISTNAME=unknown DISTVER= - -if [ -f /etc/os-release ]; then +if [ -f /etc/solus-release ]; then + DISTNAME=solus +elif [ -f /etc/lsb-release ]; then + . /etc/lsb-release + DISTNAME=$(echo ${DISTRIB_ID} | awk '{print tolower($0)}') + DISTVER=${DISTRIB_RELEASE} + if [ "$DISTNAME" != "ubuntu" ]; then + if [ "$DISTNAME" = "linuxmint" ]; then + if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ]; then + DISTNAME=ubuntu + DISTVER=18.04 + fi + elif [ "$DISTNAME" = "elementary" ]; then + if [ "$DISTVER" = "5.0" ]; then + DISTNAME=ubuntu + DISTVER=18.04 + fi + else + DISTNAME=unknown + DISTVER= + fi + fi +elif [ -f /etc/debian_version ]; then + DISTNAME=debian + DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}') +elif [ -f /etc/os-release ]; then . /etc/os-release if [ "$ID" == "arch" ]; then DISTNAME=arch @@ -15,33 +39,4 @@ if [ -f /etc/os-release ]; then fi fi -if [ "DISTNAME" = "unknown" ]; then - if [ -f /etc/solus-release ]; then - DISTNAME=solus - elif [ -f /etc/lsb-release ]; then - . /etc/lsb-release - DISTNAME=$(echo ${DISTRIB_ID} | awk '{print tolower($0)}') - DISTVER=${DISTRIB_RELEASE} - if [ "$DISTNAME" != "ubuntu" ]; then - if [ "$DISTNAME" = "linuxmint" ]; then - if [ "$DISTVER" = "19" ] || [ "$DISTVER" = "19.1" ]; then - DISTNAME=ubuntu - DISTVER=18.04 - fi - elif [ "$DISTNAME" = "elementary" ]; then - if [ "$DISTVER" = "5.0" ]; then - DISTNAME=ubuntu - DISTVER=18.04 - fi - else - DISTNAME=unknown - DISTVER= - fi - fi - elif [ -f /etc/debian_version ]; then - DISTNAME=debian - DISTVER=$(head -1 /etc/debian_version|awk -F. '{print $1}') - fi -fi - echo ${DISTNAME}${DISTVER}