From 3abc39598a3b367825bc3bf3dcfd75dce040ee50 Mon Sep 17 00:00:00 2001 From: Simon Biewald Date: Sat, 15 Aug 2020 16:21:13 +0100 Subject: [PATCH] Add LINUX_VERSION_LIKE for variations of Linux distribution Real Ubuntu and Debian do not have LINUX_VERSION_LIKE set. They are different enough to consider them as a different distribution. Tests targetting any of distributions based of those two should check both, LINUX_VERSION and LINUX_VERSION_LIKE. --- include/consts | 1 + include/osdetection | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/consts b/include/consts index 053147a4..c86519ac 100644 --- a/include/consts +++ b/include/consts @@ -140,6 +140,7 @@ ETC_PATHS="/etc /usr/local/etc" LICENSE_KEY="" LICENSE_SERVER="" LINUX_VERSION="" + LINUX_VERSION_LIKE="" LINUXCONFIGFILE="" LMDBINARY="" LMDFOUND=0 diff --git a/include/osdetection b/include/osdetection index 4af35a18..537742df 100644 --- a/include/osdetection +++ b/include/osdetection @@ -197,11 +197,13 @@ ;; "kali") LINUX_VERSION="Kali" + LINUX_VERSION_LIKE="Debian" OS_NAME="Kali Linux" OS_VERSION="Rolling release" ;; "linuxmint") LINUX_VERSION="Linux Mint" + LINUX_VERSION_LIKE="Ubuntu" OS_NAME="Linux Mint" OS_VERSION=$(grep "^VERSION_ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_VERSION_FULL=$(grep "^VERSION=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') @@ -231,18 +233,21 @@ ;; "pop") LINUX_VERSION="Pop!_OS" + LINUX_VERSION_LIKE="Ubuntu" OS_VERSION=$(grep "^VERSION_ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_VERSION_FULL=$(grep "^VERSION=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_NAME="Pop!_OS" ;; "pureos") LINUX_VERSION="PureOS" + LINUX_VERSION_LIKE="Debian" OS_VERSION=$(grep "^VERSION_ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_VERSION_FULL=$(grep "^VERSION=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_NAME="PureOS" ;; "raspbian") LINUX_VERSION="Raspbian" + LINUX_VERSION_LIKE="Debian" OS_VERSION=$(grep "^VERSION_ID=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_VERSION_FULL=$(grep "^VERSION=" /etc/os-release | awk -F= '{print $2}' | tr -d '"') OS_NAME="Raspbian" @@ -324,6 +329,7 @@ LINUX_VERSION="Ubuntu" elif [ "${FIND}" = "elementary OS" ]; then LINUX_VERSION="elementary OS" + LINUX_VERSION_LIKE="Ubuntu" OS_VERSION=$(grep "^DISTRIB_RELEASE=" /etc/lsb-release | cut -d '=' -f2) OS_FULLNAME=$(grep "^DISTRIB_DESCRIPTION=" /etc/lsb-release | cut -d '=' -f2 | sed 's/"//g') else @@ -340,6 +346,8 @@ FIND=$(lsb_release --id | awk -F: '{ print $2 }' | awk '{ print $1 }') if [ "${FIND}" = "LinuxMint" ]; then LINUX_VERSION="Linux Mint" + # LMDE (Linux Mint Debian Edition) should be detected as Debian + LINUX_VERSION_LIKE="Ubuntu" OS_VERSION=$(lsb_release --release | awk '{ print $2 }') OS_FULLNAME="Linux Mint ${OS_VERSION}" fi