From 1e2576f15a21d0144df2ab16ab7f61f496167140 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 21 Apr 2026 01:23:21 +0100 Subject: refactor: 'just status' only reports missing for groups ≥50% installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unadopted groups (e.g. gaming, nvidia on non-gaming/non-nvidia machines) no longer spam 'missing:' lines. Undeclared detection is unchanged — any installed package not in any list is still reported. --- justfile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index 1de60e4..2a91239 100644 --- a/justfile +++ b/justfile @@ -52,12 +52,27 @@ add group pkg: fi paru -S --needed '{{ pkg }}' -# Show package and dotfile drift +# Show package and dotfile drift (only for groups ≥50% installed) status: #!/bin/sh - echo "=== Package drift ===" + active_file=$(mktemp) + trap 'rm -f "$active_file"' EXIT + for file in meta/*.txt; do + pkgs=$(grep -v '^\s*#' "$file" | grep -v '^\s*$') + total=$(echo "$pkgs" | wc -l) + installed=0 + for pkg in $pkgs; do + pacman -Qi "$pkg" >/dev/null 2>&1 && installed=$((installed + 1)) + done + if [ $((installed * 2)) -ge "$total" ]; then + echo "$pkgs" >> "$active_file" + fi + done + active=$(sort -u "$active_file") declared=$(cat meta/*.txt | grep -v '^\s*#' | grep -v '^\s*$' | sort -u) - echo "$declared" | while read -r pkg; do + echo "=== Package drift ===" + echo "$active" | while read -r pkg; do + [ -z "$pkg" ] && continue pacman -Qi "$pkg" >/dev/null 2>&1 || echo " missing: $pkg" done pacman -Qqe | while read -r pkg; do -- cgit v1.2.3-70-g09d2