dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.local/bin/actualizar

18 lines
519 B
Plaintext
Raw Normal View History

2019-04-22 16:17:15 +00:00
#!/usr/bin/env bash
set -euf -o pipefail
2019-04-25 03:39:38 +00:00
ping -q -c 1 1.1.1.1 > /dev/null || exit
2019-04-22 16:17:15 +00:00
2019-04-25 03:39:38 +00:00
export DISPLAY=:0.0
2019-04-22 16:17:15 +00:00
2019-04-25 03:39:38 +00:00
trap 'rm /tmp/{pacmanupdates,aurupdates} 2>/dev/null' INT TERM QUIT EXIT
2019-04-22 16:17:15 +00:00
2019-04-25 03:39:38 +00:00
nb_pac=$(checkupdates | tee /tmp/pacmanupdates | wc -l)
nb_aur=$(yay -Qua | tee /tmp/aurupdates | wc -l)
2019-04-22 16:17:15 +00:00
2019-04-25 03:39:38 +00:00
if ((nb_pac>0 || nb_aur>0)); then
((nb_aur>0)) && nb_aur="+ ${nb_aur}" && cat /tmp/aurupdates >> /tmp/pacmanupdates
((nb_aur==0)) && unset nb_aur
notify-send -i ~/Pictures/.icn/arch.png "Updates" "${nb_pac} ${nb_aur} available"
2019-04-22 16:17:15 +00:00
fi