apt update first

This commit is contained in:
Roger Pàmies Fabra 2023-01-21 01:49:59 +01:00
parent a374c65e6e
commit 3d01909226
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,8 @@ PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# vars gotify
readonly TOKEN="<TOKEN_GOTIFY_APP>"
apt update -qq
#https://askubuntu.com/questions/269606/apt-get-count-the-number-of-updates-available
num=`apt-get -q -y --ignore-hold --allow-change-held-packages --allow-unauthenticated -s dist-upgrade | /bin/grep ^Inst | wc -l`;
@ -17,5 +19,5 @@ else
updates=$(echo $updates|tr -d '\n')
OUT="There are **$num** updates: \r"
OUT="${OUT} Packages: *$updates*"
sh ./gotifypush.sh "Kerolap updates notifier" "$OUT" 5 $TOKEN
sh ./gotifypush.sh "Example host updates notifier" "$OUT" 5 $TOKEN
fi