summaryrefslogtreecommitdiffstats
path: root/daemon/system-info.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-18 15:22:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-18 15:22:14 +0000
commit970987c0d6e99ef0db866a09396d5613042a94d1 (patch)
treeaf21bdbc146083814d19b8d553f15e671ae7fd24 /daemon/system-info.sh
parentReleasing debian version 1.29.1-3. (diff)
downloadnetdata-970987c0d6e99ef0db866a09396d5613042a94d1.tar.xz
netdata-970987c0d6e99ef0db866a09396d5613042a94d1.zip
Merging upstream version 1.29.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/system-info.sh')
-rwxr-xr-xdaemon/system-info.sh22
1 files changed, 12 insertions, 10 deletions
diff --git a/daemon/system-info.sh b/daemon/system-info.sh
index 80eb82f86..05d8667c2 100755
--- a/daemon/system-info.sh
+++ b/daemon/system-info.sh
@@ -108,9 +108,9 @@ else
fi
# shellcheck disable=SC2153
- if [ "${NAME}" = "unknown" ] || [ "${VERSION}" = "unknown" ] || [ "${ID}" = "unknown" ]; then
+ if [ "${CONTAINER_NAME}" = "unknown" ] || [ "${CONTAINER_VERSION}" = "unknown" ] || [ "${CONTAINER_ID}" = "unknown" ]; then
if [ -f "/etc/lsb-release" ]; then
- if [ "${OS_DETECTION}" = "unknown" ]; then
+ if [ "${CONTAINER_OS_DETECTION}" = "unknown" ]; then
CONTAINER_OS_DETECTION="/etc/lsb-release"
else
CONTAINER_OS_DETECTION="Mixed"
@@ -119,19 +119,19 @@ else
DISTRIB_RELEASE="unknown"
DISTRIB_CODENAME="unknown"
eval "$(grep -E "^(DISTRIB_ID|DISTRIB_RELEASE|DISTRIB_CODENAME)=" < /etc/lsb-release)"
- if [ "${NAME}" = "unknown" ]; then CONTAINER_NAME="${DISTRIB_ID}"; fi
- if [ "${VERSION}" = "unknown" ]; then CONTAINER_VERSION="${DISTRIB_RELEASE}"; fi
- if [ "${ID}" = "unknown" ]; then CONTAINER_ID="${DISTRIB_CODENAME}"; fi
+ if [ "${CONTAINER_NAME}" = "unknown" ]; then CONTAINER_NAME="${DISTRIB_ID}"; fi
+ if [ "${CONTAINER_VERSION}" = "unknown" ]; then CONTAINER_VERSION="${DISTRIB_RELEASE}"; fi
+ if [ "${CONTAINER_ID}" = "unknown" ]; then CONTAINER_ID="${DISTRIB_CODENAME}"; fi
fi
if [ -n "$(command -v lsb_release 2> /dev/null)" ]; then
- if [ "${OS_DETECTION}" = "unknown" ]; then
+ if [ "${CONTAINER_OS_DETECTION}" = "unknown" ]; then
CONTAINER_OS_DETECTION="lsb_release"
else
CONTAINER_OS_DETECTION="Mixed"
fi
- if [ "${NAME}" = "unknown" ]; then CONTAINER_NAME="$(lsb_release -is 2> /dev/null)"; fi
- if [ "${VERSION}" = "unknown" ]; then CONTAINER_VERSION="$(lsb_release -rs 2> /dev/null)"; fi
- if [ "${ID}" = "unknown" ]; then CONTAINER_ID="$(lsb_release -cs 2> /dev/null)"; fi
+ if [ "${CONTAINER_NAME}" = "unknown" ]; then CONTAINER_NAME="$(lsb_release -is 2> /dev/null)"; fi
+ if [ "${CONTAINER_VERSION}" = "unknown" ]; then CONTAINER_VERSION="$(lsb_release -rs 2> /dev/null)"; fi
+ if [ "${CONTAINER_ID}" = "unknown" ]; then CONTAINER_ID="$(lsb_release -cs 2> /dev/null)"; fi
fi
fi
fi
@@ -143,7 +143,9 @@ HOST_VERSION="unknown"
HOST_VERSION_ID="unknown"
HOST_ID="unknown"
HOST_ID_LIKE="unknown"
-if [ "${CONTAINER}" = "unknown" ]; then
+
+# 'systemd-detect-virt' returns 'none' if there is no hardware/container virtualization.
+if [ "${CONTAINER}" = "unknown" ] || [ "${CONTAINER}" = "none" ]; then
for v in NAME ID ID_LIKE VERSION VERSION_ID OS_DETECTION; do
eval "HOST_$v=\$CONTAINER_$v; CONTAINER_$v=none"
done