New method of checking pkg number cache age

master
Mateusz Chochół 7 years ago
parent ea39f9f8e3
commit f2456e5281
  1. 11
      bmotd.sh

@ -74,9 +74,16 @@ update() {
KERNEL=$(uname -r)
EXTERNAL=$(dig TXT +time=3 +tries=2 +short o-o.myaddr.l.google.com @ns1.google.com | tr -d '"')
# Get number of updates awaiting
# Check if pkg number cache exists
test -f "$CACHEPATH/pkg_count" || PKG_REFRESH=1
[[ $(date +%H%M) == "1510" ]] && PKG_REFRESH=1
# Check if pkg number cache is outdate
LASTMODIFICATION=$(date +%s -r "$CACHEPATH/pkg_count")
CURRENTTIME=$(date +%s)
UPDATEDAGO=$((CURRENTTIME - LASTMODIFICATION))
[ "$UPDATEDAGO" -gt "86400" ] && PKG_REFRESH=1
# If cache old or non existent, get number of updates awaiting
if [ $PKG_REFRESH ]; then
case "$OSID" in
debian|osmc|linuxmint)

Loading…
Cancel
Save