Files
thomas.koppandClaude Opus 5 035c88c31c feat: package lists per role, with a check-and-install script
The lists are derived rather than typed. beastix has 512 explicit packages -
years of experiments among them - so taking that as "what this machine needs"
would be meaningless. curate.sh combines four usage signals, each of which
alone has a blind spot: shell history sees no GUI application, KDE's activity
database sees no chat client, autostart sees only what starts by itself, and
flatpak entries never appear in pacman -Qqe at all. That reduces 512 to 62.

The split follows the data: what beastix and shron both have becomes the base,
the rest of beastix becomes desktop, shron's own becomes server.

base-devel is one entry in the server list rather than its 26 members. It
stopped being a package group in 2022 - "pacman -Sg base-devel" now fails
outright - and is a meta package today. base, grub and linux-lts are dropped
entirely; they arrive with the operating system.

packages.sh never removes anything. Extras are reported and left alone, for
the same reason the BookStack playbook refuses to: on a server, individual
packages carry mail and web services. It avoids process substitution because
/bin/sh is dash on Debian and a POSIX-mode bash on macOS, and this has to run
on both.

Verified on beastix: 62 wanted, 0 missing, 450 extra reported and untouched;
install is a no-op.

The server list is a snapshot from 2026-08-06 and wants re-reading when shron
is reachable again - its login session has since expired.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 16:11:45 +02:00

43 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Build a candidate "daily use" package list from two independent signals.
#
# Shell history alone is blind to anything started from the desktop menu, and a
# .desktop file alone says nothing about whether the thing is ever opened. Taken
# together they cover both halves: CLI tools by how often they were actually
# run, GUI applications by the fact that they were explicitly installed and ship
# a menu entry.
#
# Everything here is a candidate, not a decision. The point is to replace
# guessing about 512 packages with a list short enough to read.
set -u
OUT=/home/templis/.claude/jobs/e44cbeae/tmp
EXPLICIT=$(mktemp)
pacman -Qqe | sort -u > "$EXPLICIT"
# One pass over the file lists instead of one pacman -Qo per command: -Qo forks
# a lookup every time and takes minutes for 40 commands.
MAP="$OUT/file2pkg.txt"
pacman -Ql $(cat "$EXPLICIT") 2>/dev/null | awk '$2 ~ /\/(bin|sbin)\/[^\/]+$/ {n=split($2,a,"/"); print a[n], $1}' | sort -u > "$MAP"
# --- Signal 1: commands actually run, mapped to their package -------------
: > "$OUT/cli_pkgs.txt"
while read -r count cmd; do
[ "${count:-0}" -lt 5 ] && continue
pkg=$(awk -v c="$cmd" '$1 == c {print $2; exit}' "$MAP")
[ -n "$pkg" ] && printf '%s\t%s\t%s\n' "$count" "$pkg" "$cmd"
done < /tmp/claude-1000/cmdfreq.txt | sort -rn -k1 > "$OUT/cli_pkgs.txt"
# --- Signal 2: explicitly installed packages that ship a menu entry -------
: > "$OUT/gui_pkgs.txt"
pacman -Qlq $(cat "$EXPLICIT") 2>/dev/null | grep -E '/usr/share/applications/[^/]+\.desktop$' > "$OUT/desktop_files.txt"
while read -r pkg; do
if pacman -Qlq "$pkg" 2>/dev/null | grep -qE '/usr/share/applications/[^/]+\.desktop$'; then
echo "$pkg"
fi
done < "$EXPLICIT" > "$OUT/gui_pkgs.txt"
echo "CLI-Pakete aus History : $(awk '{print $2}' "$OUT/cli_pkgs.txt" | sort -u | wc -l)"
echo "GUI-Pakete mit Menue : $(wc -l < "$OUT/gui_pkgs.txt")"
rm -f "$EXPLICIT"