2019-01-10 10:45:52 +01:00
|
|
|
#!/bin/sh
|
2024-05-01 12:14:49 +02:00
|
|
|
# Wait for connection
|
2023-12-18 21:58:40 +01:00
|
|
|
source $(dirname $0)/../.env
|
2024-05-01 12:14:49 +02:00
|
|
|
connect=$(ping -q -w 1 -c 1 8.8.8.8 &> /dev/null)
|
2019-06-23 15:49:34 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
updates_arch=$(/usr/bin/checkupdates | wc -l)
|
2023-02-18 22:29:26 +01:00
|
|
|
# a restricts to AUR packages
|
|
|
|
updates_aur=$(yay -Qua | wc -l)
|
2019-06-23 15:49:34 +02:00
|
|
|
updates=$(("$updates_arch" + "$updates_aur"))
|
|
|
|
if [ "$updates" -gt 0 ]; then
|
2023-12-18 21:58:40 +01:00
|
|
|
echo "%{F$MOCHA_MAUVE}%{F$MOCHA_TEXT} $updates_arch | $updates_aur"
|
2019-06-23 15:49:34 +02:00
|
|
|
else
|
2023-12-18 21:58:40 +01:00
|
|
|
echo "%{F$MOCHA_GREEN}%{F$MOCHA_TEXT} 0"
|
2019-06-23 15:49:34 +02:00
|
|
|
fi
|
2019-01-10 10:45:52 +01:00
|
|
|
else
|
2019-06-23 15:49:34 +02:00
|
|
|
echo "%{F#77dd77}%{F#ddd} Offline"
|
2019-01-10 10:45:52 +01:00
|
|
|
fi
|