Fix stale UI cache, BEN2 edge quality, and fresh-install permissions

- Serve /dist and /src with Cache-Control: no-cache so browsers always
  revalidate the webpack bundle (it has a fixed filename with no content
  hash, so a stale browser cache was hiding the new Remove Background
  model dropdown after the rebuild).
- Enable BEN2's refine_foreground pass by default - it's the model's own
  documented option for preserving fine/semi-transparent edge detail
  (text borders, light rays) instead of a harder cutout, at a small
  speed cost.
- Make install-local-gpu.sh and bring-up-local-gpu.sh pre-create ./data
  as the invoking non-root user before Docker ever runs, so its daemon
  never gets a chance to auto-create those bind-mount dirs as root.
- Make prefetch-models.sh self-heal a root-owned ./data automatically
  (sudo chown) instead of erroring out with a manual fix-it command.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ro4PwQKvSc3CH19LSN21Ht
This commit is contained in:
Claude
2026-06-18 17:09:23 +00:00
parent eca834a7f0
commit b4a790473c
5 changed files with 63 additions and 13 deletions
+21 -6
View File
@@ -28,16 +28,31 @@ fi
# mkdir -p succeeds silently on an already-existing directory even when we
# can't write into it, so actually test writability rather than trusting that.
check_writable() {
mkdir -p "$1" 2>/dev/null
touch "$1/.write_test" 2>/dev/null && rm -f "$1/.write_test"
}
NEED_CHOWN=0
for d in data/models data/hf_cache; do
mkdir -p "$d" 2>/dev/null
if ! { touch "$d/.write_test" 2>/dev/null && rm -f "$d/.write_test"; }; then
echo "✗ No write permission in ./$d" >&2
echo " This usually means Docker created ./data as root on a previous run." >&2
echo " Fix permanently (the container runs as root and will still work fine):" >&2
check_writable "$d" || NEED_CHOWN=1
done
if [ "$NEED_CHOWN" -eq 1 ]; then
echo "⚠ ./data isn't writable by $(id -un) — this usually means Docker created it as root on a previous run."
echo " Fixing ownership (the container runs as root and will still work fine afterward):"
echo " sudo chown -R $(id -u):$(id -g) ./data"
if ! sudo chown -R "$(id -u):$(id -g)" ./data; then
echo "✗ Could not fix ownership automatically (sudo failed or unavailable)." >&2
echo " Run this manually, then re-run this script:" >&2
echo " sudo chown -R \$(id -u):\$(id -g) ./data" >&2
exit 1
fi
done
for d in data/models data/hf_cache; do
check_writable "$d" || { echo "✗ Still no write permission in ./$d after chown." >&2; exit 1; }
done
echo "✓ Fixed."
fi
PREFETCH_SDXL=0
if [ "${1:-}" = "--sdxl" ]; then