This commit is contained in:
sharky committed 2026-10-04 16:56:00 +02:00
1 parent 44d247d506
commit 300096f913
1 file changed
+20 -1
+20 -1
View File
@@ -216,7 +216,25 @@ if [[ "$NOTIFY_ENABLED" == "yes" ]]; then
[[ -n "$target" ]] && echo " - $target" [[ -n "$target" ]] && echo " - $target"
done <<< "$TARGETS" done <<< "$TARGETS"
# Eingebautes Proxmox-Fallback nicht als bevorzugtes Ziel behandeln.
# Wenn genau ein anderes Target existiert, automatisch verwenden.
CUSTOM_TARGETS="$(printf '%s\n' "$TARGETS" | grep -Fxv 'mail-to-root' || true)"
CUSTOM_COUNT="$(printf '%s\n' "$CUSTOM_TARGETS" | sed '/^$/d' | wc -l)"
if [[ "$CUSTOM_COUNT" -eq 1 ]]; then
NOTIFY_TARGET="$(printf '%s\n' "$CUSTOM_TARGETS" | sed '/^$/d' | head -n1)"
echo echo
echo "Notification-Target automatisch gewählt: $NOTIFY_TARGET"
elif [[ "$CUSTOM_COUNT" -eq 0 ]]; then
# Nur mail-to-root vorhanden. Das ist ein gültiges Proxmox-Ziel.
NOTIFY_TARGET="mail-to-root"
echo
echo "Notification-Target automatisch gewählt: $NOTIFY_TARGET"
else
echo
echo "Mehrere benutzerdefinierte Targets vorhanden."
while true; do while true; do
read -r -p "Notification-Target [${NOTIFY_TARGET:-keins}]: " NEW_TARGET </dev/tty read -r -p "Notification-Target [${NOTIFY_TARGET:-keins}]: " NEW_TARGET </dev/tty
NEW_TARGET="${NEW_TARGET:-$NOTIFY_TARGET}" NEW_TARGET="${NEW_TARGET:-$NOTIFY_TARGET}"
@@ -226,7 +244,7 @@ if [[ "$NOTIFY_ENABLED" == "yes" ]]; then
continue continue
fi fi
if printf '%s\n' "$TARGETS" | grep -Fxq "$NEW_TARGET"; then if printf '%s\n' "$CUSTOM_TARGETS" | grep -Fxq "$NEW_TARGET"; then
NOTIFY_TARGET="$NEW_TARGET" NOTIFY_TARGET="$NEW_TARGET"
break break
fi fi
@@ -234,6 +252,7 @@ if [[ "$NOTIFY_ENABLED" == "yes" ]]; then
echo "Target '$NEW_TARGET' wurde nicht gefunden." echo "Target '$NEW_TARGET' wurde nicht gefunden."
done done
fi fi
fi
else else
NOTIFY_TARGET="" NOTIFY_TARGET=""
fi fi