1
0
Fork 0
dotfiles/.local/bin/cron/checkup

15 lines
539 B
Bash
Executable File

#!/bin/sh
askupgrade() {
[ "$(notify-send -c updates --action=Yes=Yes --action=No=No " Repository Sync" "Updates available. Update now?")" = 'Yes' ] && $TERMINAL -e upgrades
}
\xbps-install -Sun 1>/tmp/xbps_updates 2>/tmp/xbps_errors
ne="$(grep -c broken /tmp/xbps_errors)"
n="$(grep -c -e update -e install /tmp/xbps_updates)"
if [ "$n" != "0" ] && [ "$ne" != "0" ]; then
notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)"
elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then
askupgrade
fi