From 8888b01dcd5cb93fa3d4d15d79a568d57841ffbc Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Tue, 5 Mar 2019 19:31:36 +0100 Subject: Store date and timestamp for EOL --- include/osdetection | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/osdetection b/include/osdetection index 069167bb..5ab80293 100644 --- a/include/osdetection +++ b/include/osdetection @@ -512,14 +512,16 @@ # Check if this OS is end-of-life EOL=255 EOL_DATE="" + EOL_TIMESTAMP=0 if [ ! -z "${OS_VERSION}" ]; then if [ -f "${DBDIR}/software-eol.db" ]; then FIND="${OS_FULLNAME}" - EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $4}}' ${DBDIR}/software-eol.db | head -n 1) - if [ ! -z "${EOL_DATE}" ]; then + EOL_TIMESTAMP=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $4}}' ${DBDIR}/software-eol.db | head -n 1) + if [ ! -z "${EOL_TIMESTAMP}" ]; then + EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $3}}' ${DBDIR}/software-eol.db | head -n 1) NOW=$(date "+%s") if [ ! -z "${NOW}" ]; then - if [ ${NOW} -gt ${EOL_DATE} ]; then + if [ ${NOW} -gt ${EOL_TIMESTAMP} ]; then EOL=1 else EOL=0 -- cgit v1.2.3