Stop being stupid

Avoid infinite update checking when offline
master
Quentin Duchemin 2019-06-23 15:49:34 +02:00
parent eae02c0f8d
commit d809c2afdf
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
1 changed files with 11 additions and 15 deletions

View File

@ -1,19 +1,15 @@
#!/bin/sh #!/bin/sh
# Wait until we can ping default gateway connect=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` &> /dev/null)
until ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null if [ $? -eq 0 ]; then
do updates_arch=$(/usr/bin/checkupdates | wc -l)
sleep 1 updates_aur=$(/usr/bin/checkupdates-aur | wc -l)
done updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
updates_arch=$(/usr/bin/checkupdates | wc -l) echo "%{F#dd7777}%{F#ddd} $updates"
else
updates_aur=$(/usr/bin/checkupdates-aur | wc -l) echo "%{F#77dd77}%{F#ddd} 0"
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo "%{F#dd7777}%{F#ddd} $updates"
else else
echo "%{F#77dd77}%{F#ddd} 0" echo "%{F#77dd77}%{F#ddd} Offline"
fi fi