Store date and timestamp for EOL

This commit is contained in:
Michael Boelen 2019-03-05 19:31:36 +01:00
parent 32fc4a01b0
commit 8888b01dcd
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
1 changed files with 5 additions and 3 deletions

View File

@ -512,14 +512,16 @@
# Check if this OS is end-of-life # Check if this OS is end-of-life
EOL=255 EOL=255
EOL_DATE="" EOL_DATE=""
EOL_TIMESTAMP=0
if [ ! -z "${OS_VERSION}" ]; then if [ ! -z "${OS_VERSION}" ]; then
if [ -f "${DBDIR}/software-eol.db" ]; then if [ -f "${DBDIR}/software-eol.db" ]; then
FIND="${OS_FULLNAME}" FIND="${OS_FULLNAME}"
EOL_DATE=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $4}}' ${DBDIR}/software-eol.db | head -n 1) EOL_TIMESTAMP=$(awk -v value="${FIND}" -F: '{if ($1=="os" && value ~ $2){print $4}}' ${DBDIR}/software-eol.db | head -n 1)
if [ ! -z "${EOL_DATE}" ]; then 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") NOW=$(date "+%s")
if [ ! -z "${NOW}" ]; then if [ ! -z "${NOW}" ]; then
if [ ${NOW} -gt ${EOL_DATE} ]; then if [ ${NOW} -gt ${EOL_TIMESTAMP} ]; then
EOL=1 EOL=1
else else
EOL=0 EOL=0