2019-10-21 18:20:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Prints out the number of pacman updates (Arch Linux)
|
|
|
|
# Requires an internet connection
|
2019-10-21 19:09:02 +00:00
|
|
|
# Depends on yay and checkupdates (pacman-contrib)
|
2020-07-04 22:40:38 +00:00
|
|
|
# Optional: add --devel flag to the yay cmd to check for *-git package updates.
|
2019-10-21 18:20:06 +00:00
|
|
|
|
2019-11-06 14:19:23 +00:00
|
|
|
PREFIX=' Updates: '
|
2019-10-21 18:20:06 +00:00
|
|
|
|
2019-11-06 14:19:23 +00:00
|
|
|
get_updates()
|
2019-10-21 18:20:06 +00:00
|
|
|
{
|
|
|
|
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
|
|
|
|
updates_arch=0
|
|
|
|
fi
|
|
|
|
|
2020-07-04 22:40:38 +00:00
|
|
|
if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
|
2019-10-21 18:20:06 +00:00
|
|
|
updates_aur=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
updates=$(("$updates_arch" + "$updates_aur"))
|
|
|
|
|
2019-10-24 19:09:35 +00:00
|
|
|
echo "$PREFIX$updates"
|
2019-10-21 18:20:06 +00:00
|
|
|
}
|
|
|
|
|
2019-11-06 13:57:07 +00:00
|
|
|
if [ $(( 10#$(date '+%M') % 3 )) -eq 0 ] && [ $(( 10#$(date '+%S') )) -eq 5 ]; then
|
|
|
|
get_updates
|
|
|
|
fi
|