scripts/void/xcheckupdates

23 lines
600 B
Plaintext
Raw Normal View History

2021-01-11 11:33:15 +00:00
#!/bin/zsh
ICON=/usr/share/icons/Papirus/24x24/panel/software-update-available.png
IDCACHE=${XDG_CACHE_HOME:-$HOME/.cache}/xcheckupdates-id
2021-01-11 11:33:15 +00:00
zparseopts -D -E l=list -list=list
if [[ -e $IDCACHE ]]; then
prev_id=$(<$IDCACHE)
fi
2023-08-29 09:31:13 +00:00
sudo xbps-install -S &>/dev/null
updates=$(xbps-install -un 2>&1)
num_updates=$(echo -n $updates | wc -l)
if [[ $list ]]; then
echo -n $updates
2021-01-11 11:33:15 +00:00
fi
if [[ $num_updates -gt 0 ]]; then
notify-send -p ${prev_id+-r} $prev_id --icon=$ICON -t 0 "$num_updates Updates available"
else
notify-send -p ${prev_id+-r} $prev_id -t 1500 "Updates checked, nothing new"
fi > $IDCACHE