IS_NOTUPGRADED: /var/log/evolinux/00_prepare_system.log is deprecated #40

Manually merged
benpro merged 2 commits from 47-is_notupgraded-var-log-evolinux-00_prepare_system-log-is-deprecated into master 2019-01-17 15:31:24 +01:00

View file

@ -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,12 +533,13 @@ 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
[ $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.