From 9ae8d250a7ff0d0d30025778cb5ad0e32fa883a9 Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Sat, 20 Jun 2026 12:10:35 +0200 Subject: [PATCH] fix(iso-visuals): avoid host-global tmp in wallpaper helper (Sam & Pi) Sync the wallpaper helper and iso-visuals guidance with the project-local tmp policy, falling back to app-owned live cache paths when no project root exists.\n\nValidation: sh -n skills/iso-visuals/scripts/clawdie-wallpaper-gen.sh skills/iso-visuals/scripts/clawdie-join-hive.sh; npx --yes prettier@3 --check skills/iso-visuals/SKILL.md; python3 scripts/layered_soul.py validate . --- skills/iso-visuals/SKILL.md | 16 ++++++--- .../scripts/clawdie-wallpaper-gen.sh | 34 +++++++++++++++++-- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/skills/iso-visuals/SKILL.md b/skills/iso-visuals/SKILL.md index c6f0455..fbd6b1a 100644 --- a/skills/iso-visuals/SKILL.md +++ b/skills/iso-visuals/SKILL.md @@ -70,15 +70,20 @@ install -m 755 scripts/clawdie-wallpaper-gen.sh \ ``` The helper falls back to the stock XFCE background, then to a generated dark solid -background under `/tmp`. It should not try to create files under `/usr/local/share` -at runtime unless explicitly requested by the operator. +background under project-local `tmp/` when a checkout is available. On the live USB, +where there is usually no project root, it uses an app-owned cache directory such as +`$XDG_CACHE_HOME/clawdie` or `$HOME/.cache/clawdie`. It should not try to create +files under `/usr/local/share` at runtime unless explicitly requested by the operator. **Optional runtime/session wiring:** ```bash -/usr/local/bin/clawdie-wallpaper-gen /tmp/clawdie-wallpaper.png +PROJECT_ROOT=$(git rev-parse --show-toplevel) +PROJECT_TMP="$PROJECT_ROOT/tmp" +mkdir -p "$PROJECT_TMP" +/usr/local/bin/clawdie-wallpaper-gen "$PROJECT_TMP/clawdie-wallpaper.png" xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image \ - -s /tmp/clawdie-wallpaper.png + -s "$PROJECT_TMP/clawdie-wallpaper.png" ``` Requires ImageMagick (`ImageMagick7` in the ISO package list; `magick` or @@ -166,7 +171,8 @@ After booting the ISO: reports provider.env status without exposing secrets, registers or reports already registered, then waits for Enter. 4. **Wallpaper helper:** running `/usr/local/bin/clawdie-wallpaper-gen` writes an - image to `/tmp/clawdie-wallpaper.png` using the Clawdie wallpaper as base. + image under project-local `tmp/` when run from a checkout, or an app-owned live + cache directory when no project root exists, using the Clawdie wallpaper as base. 5. **Panel indicator helper:** running `/usr/local/bin/colibri-panel-indicator` prints genmon XML. Only claim panel visibility after genmon is packaged and wired into the seeded panel or configured manually. diff --git a/skills/iso-visuals/scripts/clawdie-wallpaper-gen.sh b/skills/iso-visuals/scripts/clawdie-wallpaper-gen.sh index 88db83a..9069d71 100755 --- a/skills/iso-visuals/scripts/clawdie-wallpaper-gen.sh +++ b/skills/iso-visuals/scripts/clawdie-wallpaper-gen.sh @@ -1,17 +1,40 @@ #!/bin/sh # Generate a wallpaper with machine identity overlaid. -# Safe to run on first boot; caches result in /tmp/clawdie-wallpaper.png. +# Safe to run on first boot; caches result in project-local tmp/ when a project +# root is available, otherwise in the live user's app-owned cache directory. # Requires ImageMagick (magick or convert). Tailscale is optional. -OUT="${1:-/tmp/clawdie-wallpaper.png}" 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 } +project_root() { + if [ -n "${CLAWDIE_PROJECT_ROOT:-}" ]; then + printf '%s\n' "$CLAWDIE_PROJECT_ROOT" + elif have git && git rev-parse --show-toplevel >/dev/null 2>&1; then + git rev-parse --show-toplevel + else + return 1 + fi +} + +scratch_dir() { + if [ -n "${CLAWDIE_TMP:-}" ]; then + printf '%s\n' "$CLAWDIE_TMP" + elif _root=$(project_root); then + printf '%s/tmp\n' "$_root" + elif [ -n "${XDG_CACHE_HOME:-}" ]; then + printf '%s/clawdie\n' "$XDG_CACHE_HOME" + elif [ -n "${HOME:-}" ]; then + printf '%s/.cache/clawdie\n' "$HOME" + else + printf '%s\n' "/var/cache/clawdie" + fi +} + if have magick; then im() { magick "$@"; } elif have convert; then @@ -21,6 +44,11 @@ else exit 1 fi +SCRATCH_DIR=$(scratch_dir) +mkdir -p "$SCRATCH_DIR" +OUT="${1:-${SCRATCH_DIR}/clawdie-wallpaper.png}" +FALLBACK_BG="${SCRATCH_DIR}/clawdie-wallpaper-base.png" + HOST=$(hostname 2>/dev/null || echo "clawdie-live") if have tailscale; then TS_IP=$(tailscale ip -4 2>/dev/null | head -n 1)