From 956877442a3f43243fed89c491d9bdddd1ac77cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S=C3=89RIE?= Date: Fri, 14 Sep 2018 15:52:08 +0200 Subject: [PATCH 1/2] WIP: Removes /var/log/evolinux/00_prepare_system.log TODO: Workaround in special case when the server was never installed TODO: be sure that the final check with and logic is OK. --- evocheck.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 4fc9a8c..0493033 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -522,7 +522,9 @@ if [ -e /etc/debian_version ]; then # Check if no package has been upgraded since $limit. if [ "$IS_NOTUPGRADED" = 1 ]; then - last_upgrade=$(date +%s -d $(zgrep -h upgrade /var/log/dpkg.log* |sort -n |tail -1 |cut -f1 -d ' ')) + if zgrep -hq upgrade /var/log/dpkg.log*; then + last_upgrade=$(date +%s -d $(zgrep -h upgrade /var/log/dpkg.log* |sort -n |tail -1 |cut -f1 -d ' ')) + fi if grep -q '^mailto="listupgrade-todo@' /etc/evolinux/listupgrade.cnf \ || grep -q -E '^[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[^\*]' /etc/cron.d/listupgrade; then # Manual upgrade process @@ -531,8 +533,8 @@ if [ -e /etc/debian_version ]; then # Regular process limit=$(date +%s -d "now - 90 days") fi - if [ -f /var/log/evolinux/00_prepare_system.log ]; then - install_date=$(stat -c %Z /var/log/evolinux/00_prepare_system.log) + if [ -d /var/log/installer ]; then + install_date=$(stat -c %Z /var/log/installer) else install_date=0 fi -- 2.39.2 From 48561592eefc2ec5241304897f7c7bf1c401ab3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Wed, 16 Jan 2019 14:12:12 +0100 Subject: [PATCH 2/2] Replace and condition by or condition Check install_date or last_upgrade, because if you never upgraded you will never match the limit --- evocheck.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evocheck.sh b/evocheck.sh index 0493033..f3a04eb 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -538,7 +538,8 @@ if [ -e /etc/debian_version ]; then else install_date=0 fi - [ $install_date -lt $limit ] && [ $last_upgrade -lt $limit ] && echo 'IS_NOTUPGRADED FAILED!' + # Check install_date or last_upgrade, because if you never upgraded you will never match the limit + ( [ $install_date -lt $limit ] || [ $last_upgrade -lt $limit ] ) && echo 'IS_NOTUPGRADED FAILED!' fi # Check if reserved blocks for root is at least 5% on every mounted partitions. -- 2.39.2