Merge branch 'master' of PorridgePi/dotfiles

This commit is contained in:
PorridgePi
2025-04-04 11:14:15 +08:00

View File

@@ -0,0 +1,10 @@
lastAptUpdateSeconds=$(date +%s -r /var/cache/apt/pkgcache.bin)
currentSeconds=$(date +%s)
diffSeconds=$(($currentSeconds - $lastAptUpdateSeconds))
echo "apt update was last run $diffSeconds second(s) ago"
# Run apt update if it has not been run for more than 30 minutes
if [[ "$diffSeconds" -gt 1800 ]]; then
echo 'Running apt update...'
sudo apt update
fi