Only run checkupdates when there are updates available
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Alexander Schäferdiek 2023-04-10 09:08:01 +02:00
parent 9c9dfee661
commit 2b0d441c35

View file

@ -68,11 +68,11 @@ source_config "$HOME/.check_updates.conf" "/etc/check_updates.conf"
apply_defaults apply_defaults
check_required check_required
CHECK_UPDATES_UPDATES=$(eval "${CHECK_UPDATES_UPDATES_CMD}")
CHECK_UPDATES_UPDATES_AMOUNT=$(eval "${CHECK_UPDATES_UPDATES_AMOUNT_CMD}") CHECK_UPDATES_UPDATES_AMOUNT=$(eval "${CHECK_UPDATES_UPDATES_AMOUNT_CMD}")
HOSTNAME=$(hostname) HOSTNAME=$(hostname)
if [[ "$CHECK_UPDATES_UPDATES_AMOUNT" -gt "0" ]]; then if [[ "$CHECK_UPDATES_UPDATES_AMOUNT" -gt "0" ]]; then
CHECK_UPDATES_UPDATES=$(eval "${CHECK_UPDATES_UPDATES_CMD}")
SUBJECT="[updates ${HOSTNAME}]" SUBJECT="[updates ${HOSTNAME}]"
MESSAGE=$(cat <<EOF MESSAGE=$(cat <<EOF
There are ${CHECK_UPDATES_UPDATES_AMOUNT} updates available on ${HOSTNAME}. There are ${CHECK_UPDATES_UPDATES_AMOUNT} updates available on ${HOSTNAME}.