22 lines
409 B
Bash
22 lines
409 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
GOTIFY_FILE=$(<~/.gotify)
|
||
|
GOTIFY_TOKEN=${GOTIFY_FILE##*( )}
|
||
|
HOST="$(hostname)"
|
||
|
TITLE="Updates available on $HOST"
|
||
|
|
||
|
if [ "$EUID" -ne 0 ]; then
|
||
|
echo "Please run as root"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
apt update
|
||
|
|
||
|
UPDATE=$(apt list --upgradable)
|
||
|
|
||
|
echo "$UPDATE"
|
||
|
|
||
|
if [[ $UPDATE == *$'\n'* ]]; then
|
||
|
curl -F "title=$TITLE" -F "message=$UPDATE" -F "priority=5" "https://push.sp-codes.de/message?token=$GOTIFY_TOKEN"
|
||
|
fi
|