From 1e7d5715de453c838829b8e97a345b9396a051df Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:10 +0100 Subject: fix(just): unit-status handles template instances and static units - use systemctl is-enabled per curated unit (list-unit-files does not show instantiated template units like btrfs-scrub@-.timer) - accept static/indirect/generated/alias states in addition to enabled - drop pkgstats.timer from curated (no [Install] section) - ignore systemd-oomd.socket (distro default) --- justfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'justfile') diff --git a/justfile b/justfile index ef7f8f4..aee1d50 100644 --- a/justfile +++ b/justfile @@ -451,9 +451,19 @@ unit-status: else : > "$tmp/ignore" fi + # Curated units missing from the system: use is-enabled to correctly + # handle instantiated template units (which list-unit-files does not show). + while read -r u; do + [ -z "$u" ] && continue + state=$(systemctl is-enabled "$u" 2>/dev/null || true) + case "$state" in + enabled|enabled-runtime|alias|static|indirect|generated) ;; + *) echo " not-enabled: $u" ;; + esac + done < "$tmp/curated" + # Enabled unit files not in curated (minus ignore list). systemctl list-unit-files --state=enabled --no-legend 2>/dev/null \ | awk '{print $1}' | grep -vE '@\.' | sort -u > "$tmp/enabled" - comm -23 "$tmp/curated" "$tmp/enabled" | sed 's/^/ not-enabled: /' comm -13 "$tmp/curated" "$tmp/enabled" | comm -23 - "$tmp/ignore" | sed 's/^/ uncurated: /' # Append one or more units to a group list and enable them (e.g. just unit-add base sshd.service) -- cgit v1.3.1