feat: add motd-assist TUI for managing dynamic MOTDs

Initial Go project built with Bubble Tea and Lip Gloss:
- Live preview and management of /etc/update-motd.d scripts
- Embedded presets (ubuntu-default, minimal, server-dashboard)
- Bundled POSIX sh style scripts (brand header, sysinfo panel, footer)
- Snapshot/restore safety around applying changes
- CLI subcommands preview, apply, restore, list-presets
- Unit tests for detect, sanitize, and apply logic
This commit is contained in:
Tronax 2026-08-24 14:19:28 +02:00
commit d56659e21a
Signed by: Tronax
SSH key fingerprint: SHA256:2pKKXDZucWvaF/GzXNz0FY53EAO1YDLN80bqS+TTz/o
34 changed files with 3260 additions and 0 deletions

50
scripts/e2e-wsl.sh Normal file
View file

@ -0,0 +1,50 @@
#!/bin/bash
# End-to-End-Test für motd-assist in einem Fake-Root.
set -euo pipefail
cd /mnt/c/Users/janik.dietz/Coding/motd-assist
go build -o /tmp/motd-assist .
R=/tmp/motdroot
rm -rf "$R"
mkdir -p "$R/etc/update-motd.d" "$R/etc/pam.d"
printf 'NAME="Ubuntu"\nPRETTY_NAME="Ubuntu 24.04.1 LTS"\n' > "$R/etc/os-release"
printf 'session optional pam_motd.so motd=/run/motd.dynamic\n' > "$R/etc/pam.d/sshd"
printf '#!/bin/sh\necho Welcome to Ubuntu \\e[1m %s\\e[0m\n' "$(hostname)" > "$R/etc/update-motd.d/00-header"
printf '#!/bin/sh\necho " * Documentation: man handbook"\n' > "$R/etc/update-motd.d/10-help-text"
chmod 755 "$R/etc/update-motd.d/00-header"
chmod 644 "$R/etc/update-motd.d/10-help-text"
echo "=== list (vorher) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist list
echo
echo "=== preview (vorher, nur 00-header aktiv) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist preview -w 60
echo
echo "=== apply server-dashboard (als root) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist apply server-dashboard
echo
echo "=== list (nachher) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist list
echo
echo "=== preview (nachher, Breite 60) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist preview -w 60
echo
echo "=== preview (nachher, Breite 40 — schmaler) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist preview -w 40 | cat -v | head -6
echo
echo "=== restore ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist restore
echo
echo "=== list (nach restore) ==="
MOTD_ASSIST_ROOT=$R /tmp/motd-assist list
echo
echo "=== ls update-motd.d ==="
ls -la "$R/etc/update-motd.d"