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.
This commit is contained in:
Simon Biewald 2020-08-15 16:21:13 +01:00
parent 529bcb2a60
commit 3abc39598a
2 changed files with 9 additions and 0 deletions

View file

@ -140,6 +140,7 @@ ETC_PATHS="/etc /usr/local/etc"
LICENSE_KEY=""
LICENSE_SERVER=""
LINUX_VERSION=""
LINUX_VERSION_LIKE=""
LINUXCONFIGFILE=""
LMDBINARY=""
LMDFOUND=0

View file

@ -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