From 1b4b2a2ff89d3da19852b3fcaa3fbd113ace3291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Thu, 21 Mar 2019 21:55:42 +0100 Subject: [PATCH] workaround possibly missing lsb_release command --- evocheck.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 6d00b38..ec814ac 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -126,11 +126,22 @@ IS_ALERTBOOT=1 IS_RSYNC=1 DEBIAN_RELEASE="" +LSB_RELEASE_BIN=$(command -v lsb_release) OPENBSD_RELEASE="" if [ -e /etc/debian_version ]; then - DEBIAN_RELEASE=$(lsb_release -c -s) - DEBIAN_VERSION=$(cat /etc/debian_version |cut -d "." -f 1) + DEBIAN_VERSION=$(cut -d "." -f 1 < /etc/debian_version) + if [ -x ${LSB_RELEASE_BIN} ]; then + DEBIAN_RELEASE=$(${LSB_RELEASE_BIN} --codename --short) + else + case ${DEBIAN_VERSION} in + 5) DEBIAN_RELEASE="lenny";; + 6) DEBIAN_RELEASE="squeeze";; + 7) DEBIAN_RELEASE="wheezy";; + 8) DEBIAN_RELEASE="jessie";; + 9) DEBIAN_RELEASE="stretch";; + esac + fi elif [ "$(uname -s)" = "OpenBSD" ]; then # use a better release name OPENBSD_RELEASE="OpenBSD" @@ -179,7 +190,7 @@ is_debian() { test -n "${DEBIAN_RELEASE}" } is_debian_lenny() { - test "${DEBIAN_VERSION}" = "5" + test "${DEBIAN_VERSION}" = "lenny" } is_debian_squeeze() { test "${DEBIAN_RELEASE}" = "squeeze"