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:
commit
d56659e21a
34 changed files with 3260 additions and 0 deletions
36
internal/assets/scripts/brand-header
Normal file
36
internal/assets/scripts/brand-header
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
# motd-assist :: brand-header — Rahmen-Header mit Hostname und Betriebssystem
|
||||
set -u
|
||||
|
||||
E=$(printf '\033')
|
||||
BLUE="${E}[1;38;5;75m"
|
||||
ORANGE="${E}[1;38;5;214m"
|
||||
DIM="${E}[2m"
|
||||
BOLD="${E}[1m"
|
||||
R="${E}[0m"
|
||||
|
||||
HOST=$(hostname 2>/dev/null || echo localhost)
|
||||
HOST=${HOST%%.*}
|
||||
|
||||
OS=Linux
|
||||
if [ -r /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
OS=${PRETTY_NAME:-Linux}
|
||||
fi
|
||||
|
||||
W=${COLUMNS:-72}
|
||||
case $W in ''|*[!0-9]*) W=72 ;; esac
|
||||
[ "$W" -gt 78 ] && W=78
|
||||
[ "$W" -lt 44 ] && W=44
|
||||
|
||||
INNER=$((W - 2))
|
||||
PLAIN=" ${HOST} - ${OS} "
|
||||
PAD=$((INNER - ${#PLAIN}))
|
||||
[ "$PAD" -lt 0 ] && PAD=0
|
||||
|
||||
RULE=$(awk -v n="$INNER" 'BEGIN{s="";for(i=0;i<n;i++)s=s "─";printf "%s",s}')
|
||||
SPACES=$(printf '%*s' "$PAD" '')
|
||||
|
||||
printf '%b\n' "$BLUE╭$R$DIM$RULE$R$BLUE╮$R"
|
||||
printf '%b\n' "$BLUE│$R $BOLD$BLUE$HOST$R $DIM·$R $ORANGE$OS$R$SPACES $BLUE│$R"
|
||||
printf '%b\n' "$BLUE╰$R$DIM$RULE$R$BLUE╯$R"
|
||||
Loading…
Add table
Add a link
Reference in a new issue