dotfiles/dot_local/scripts/zsh/executable_check-update.zsh

22 lines
525 B
Bash
Raw Normal View History

2020-06-15 09:38:18 +00:00
function checkUpdate() {
2020-06-15 10:09:28 +00:00
lastUpdateFile=$HOME/.config/last-system-upgrade
2020-06-15 09:38:18 +00:00
if [ ! -f "$lastUpdateFile" ]; then
echo "this system hasn't ever been updated using system-upgrade.sh"
echo "run system-upgrade.sh now"
return
fi
lastUpdate=$(cat $lastUpdateFile)
now=$(date "+%s")
2020-06-15 10:47:49 +00:00
if [[ $(( $now - $lastUpdate > 604800 )) -ne "0" ]]; then
2020-06-15 09:38:18 +00:00
echo "this system hasn't been updated for over a week"
echo "run system-upgrade.sh asap"
return
fi
}
checkUpdate