From 7750a86a49f75fe4487ec2c233c1d65f2c25c57e Mon Sep 17 00:00:00 2001 From: humocs-man <251756307+humocs-man@users.noreply.github.com> Date: Sun, 17 May 2026 20:30:06 +0200 Subject: [PATCH] Refactor status check to use jq Updated status check to use jq for JSON parsing. --- scripts/notify-bootc-user.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/notify-bootc-user.sh b/scripts/notify-bootc-user.sh index 372a839..e68e701 100755 --- a/scripts/notify-bootc-user.sh +++ b/scripts/notify-bootc-user.sh @@ -16,11 +16,10 @@ $BOOTC upgrade # 2. Status-Check # PRÜFUNG ANGEPASST: Wir prüfen, ob der Status EXPLIZIT 'staged: null' enthält. # Wenn dies der Fall ist, bedeutet es "System aktuell". -if $BOOTC status --json | grep -q '"staged": null"'; then - # KEIN Update gefunden (Status ist null) +if $BOOTC status --json | jq -e '.status.staged == null' >/dev/null; then + # KEIN Update gefunden $LOGGER -t "$TAG" "System aktuell (keine Updates vorhanden)." else - # Ein Update ist gestaged oder der Status ist nicht null. Wir senden die Benachrichtigung. # 3. Den ersten User finden, der nicht Root ist USER_ID=$($LOGINCTL list-users --no-legend | awk '$2 != "root" {print $1; exit}')