diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 51084c9..eb9e8a6 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -19,13 +19,19 @@ rm -f /fgc/data/browser/SingletonLock 2>/dev/null || true # Firefox profile directory (persistent if writable; fallback to cache when bind-mount is read-only). BROWSER_DIR=/fgc/data/browser +mkdir -p "$BROWSER_DIR" 2>/dev/null || true if [ ! -w "$BROWSER_DIR" ]; then echo "Warning: $BROWSER_DIR not writable; using fallback profile at /home/fgc/.cache/browser" BROWSER_DIR=/home/fgc/.cache/browser - mkdir -p "$BROWSER_DIR" + mkdir -p "$BROWSER_DIR" 2>/dev/null || true chown 1000:1000 "$BROWSER_DIR" 2>/dev/null || true fi -mkdir -p "$BROWSER_DIR" +if [ ! -w "$BROWSER_DIR" ]; then + echo "Warning: $BROWSER_DIR not writable; using temp profile at /tmp/browser" + BROWSER_DIR=/tmp/browser + mkdir -p "$BROWSER_DIR" + chmod 777 "$BROWSER_DIR" 2>/dev/null || true +fi # clean up stale firefox locks that can trigger "already running" rm -f "$BROWSER_DIR"/parent.lock "$BROWSER_DIR"/lock "$BROWSER_DIR"/.parentlock 2>/dev/null || true # Firefox preferences are stored in $BROWSER_DIR/pref.js and can be overridden by a file user.js