Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2021-01-07 13:30:51 +0300
committerGitHub <noreply@github.com>2021-01-07 13:30:51 +0300
commitc38c89ae4e5128fb3347835ca311ea3b1a255a75 (patch)
tree0ae1ccf336ba8e416b91a2a55a132d6c38cca42e /include/osdetection
parent0abf01b3583e595bca5370f8feb53da4ca8b467e (diff)
parent4a03c613438d25944680ed22f67276dff755ff3c (diff)
Merge pull request #1004 from Varbin/1003-os-detection
Test for LINUX_VERSION before setting it again
Diffstat (limited to 'include/osdetection')
-rw-r--r--include/osdetection48
1 files changed, 28 insertions, 20 deletions
diff --git a/include/osdetection b/include/osdetection
index 3c5932ce..0a6cf976 100644
--- a/include/osdetection
+++ b/include/osdetection
@@ -226,11 +226,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 '"')
@@ -278,18 +280,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"
@@ -378,31 +383,32 @@
# CPUBuilders Linux
if [ -e "/etc/cpub-release" ]; then OS_FULLNAME=$(cat /etc/cpub-release); fi
- # Debian/Ubuntu (***) - Set first to Debian
- if [ -e "/etc/debian_version" ]; then
+ if [ -z "${LINUX_VERSION}" ] && [ -e "/etc/debian_version" ]; then
+ # Debian/Ubuntu (***) - Set first to Debian
OS_VERSION=$(cat /etc/debian_version)
OS_FULLNAME="Debian ${OS_VERSION}"
LINUX_VERSION="Debian"
- fi
- # /etc/lsb-release does not exist on Debian
- if [ -e "/etc/debian_version" -a -e /etc/lsb-release ]; then
- OS_VERSION=$(cat /etc/debian_version)
- FIND=$(grep "^DISTRIB_ID=" /etc/lsb-release | cut -d '=' -f2 | sed 's/"//g')
- if [ "${FIND}" = "Ubuntu" ]; then
- OS_VERSION=$(grep "^DISTRIB_RELEASE=" /etc/lsb-release | cut -d '=' -f2)
- OS_FULLNAME="Ubuntu ${OS_VERSION}"
- LINUX_VERSION="Ubuntu"
- elif [ "${FIND}" = "elementary OS" ]; then
- LINUX_VERSION="elementary OS"
- 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
- # Catch all, in case it's unclear what specific release this is.
- OS_FULLNAME="Debian ${OS_VERSION}"
- LINUX_VERSION="Debian"
+ # /etc/lsb-release does not exist on Debian
+ if [ -e /etc/lsb-release ]; then
+ OS_VERSION=$(cat /etc/debian_version)
+ FIND=$(grep "^DISTRIB_ID=" /etc/lsb-release | cut -d '=' -f2 | sed 's/"//g')
+ if [ "${FIND}" = "Ubuntu" ]; then
+ OS_VERSION=$(grep "^DISTRIB_RELEASE=" /etc/lsb-release | cut -d '=' -f2)
+ OS_FULLNAME="Ubuntu ${OS_VERSION}"
+ 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
+ # Catch all, in case it's unclear what specific release this is.
+ OS_FULLNAME="Debian ${OS_VERSION}"
+ LINUX_VERSION="Debian"
+ fi
+ # Ubuntu test (optional) $(grep "[Uu]buntu" /proc/version)
fi
- # Ubuntu test (optional) $(grep "[Uu]buntu" /proc/version)
fi
# Override for Linux Mint, as that is initially detected as Debian or Ubuntu
@@ -410,6 +416,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