2026-06-20 10:56:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Generate a wallpaper with machine identity overlaid.
|
2026-06-20 12:05:08 +02:00
|
|
|
# Safe to run on first boot; caches result in /tmp/clawdie-wallpaper.png.
|
|
|
|
|
# Requires ImageMagick (magick or convert). Tailscale is optional.
|
2026-06-20 10:56:43 +02:00
|
|
|
|
|
|
|
|
OUT="${1:-/tmp/clawdie-wallpaper.png}"
|
2026-06-20 12:05:08 +02:00
|
|
|
CLAWDIE_BG="/usr/local/share/clawdie-iso/wallpapers/clawdie-operator-bg.png"
|
|
|
|
|
XFCE_BG="/usr/local/share/backgrounds/xfce/default.png"
|
|
|
|
|
FALLBACK_BG="/tmp/clawdie-wallpaper-base.png"
|
|
|
|
|
|
|
|
|
|
have() {
|
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if have magick; then
|
|
|
|
|
im() { magick "$@"; }
|
|
|
|
|
elif have convert; then
|
|
|
|
|
im() { convert "$@"; }
|
|
|
|
|
else
|
|
|
|
|
echo "ERROR: ImageMagick is not installed; expected magick or convert." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-06-20 10:56:43 +02:00
|
|
|
|
2026-06-20 12:05:08 +02:00
|
|
|
HOST=$(hostname 2>/dev/null || echo "clawdie-live")
|
|
|
|
|
if have tailscale; then
|
|
|
|
|
TS_IP=$(tailscale ip -4 2>/dev/null | head -n 1)
|
|
|
|
|
fi
|
|
|
|
|
[ -n "${TS_IP:-}" ] || TS_IP="offline"
|
2026-06-20 10:56:43 +02:00
|
|
|
COLIBRI_SOCK="/var/run/colibri/colibri.sock"
|
|
|
|
|
COLIBRI_PORT="9190"
|
2026-06-20 12:05:08 +02:00
|
|
|
JAIL_RELEASE=$(freebsd-version 2>/dev/null || uname -r 2>/dev/null || echo "unknown")
|
2026-06-20 10:56:43 +02:00
|
|
|
|
2026-06-20 12:05:08 +02:00
|
|
|
if [ -f "$CLAWDIE_BG" ]; then
|
|
|
|
|
BG="$CLAWDIE_BG"
|
|
|
|
|
elif [ -f "$XFCE_BG" ]; then
|
|
|
|
|
BG="$XFCE_BG"
|
|
|
|
|
else
|
|
|
|
|
BG="$FALLBACK_BG"
|
|
|
|
|
im -size 1920x1080 xc:'#1a1a2e' "$BG"
|
2026-06-20 10:56:43 +02:00
|
|
|
fi
|
|
|
|
|
|
2026-06-20 12:05:08 +02:00
|
|
|
SOCK_STATUS="down"
|
|
|
|
|
[ -S "$COLIBRI_SOCK" ] && SOCK_STATUS="socket ${COLIBRI_PORT}"
|
|
|
|
|
|
|
|
|
|
# Overlay identity text in the bottom-left corner. Do not require a specific
|
|
|
|
|
# font: ImageMagick's default font is more portable across FreeBSD package sets.
|
|
|
|
|
if ! im "$BG" \
|
|
|
|
|
-pointsize 18 -fill '#e0e0e0' \
|
2026-06-20 10:56:43 +02:00
|
|
|
-annotate +40+900 "hostname ${HOST}" \
|
|
|
|
|
-annotate +40+930 "tailscale ${TS_IP}" \
|
2026-06-20 12:05:08 +02:00
|
|
|
-annotate +40+960 "colibri ${SOCK_STATUS}" \
|
2026-06-20 10:56:43 +02:00
|
|
|
-annotate +40+990 "jail ${JAIL_RELEASE}" \
|
2026-06-20 12:05:08 +02:00
|
|
|
-pointsize 28 -fill '#8b5cf6' \
|
2026-06-20 10:56:43 +02:00
|
|
|
-annotate +40+850 "Clawdie OS" \
|
2026-06-20 12:05:08 +02:00
|
|
|
"$OUT"; then
|
|
|
|
|
echo "WARNING: identity overlay failed; copying base wallpaper instead." >&2
|
|
|
|
|
cp "$BG" "$OUT"
|
|
|
|
|
fi
|
2026-06-20 10:56:43 +02:00
|
|
|
|
|
|
|
|
echo "Wallpaper: ${OUT}"
|