chore: add writable browser profile fallback to /tmp
All checks were successful
build-and-push / lint (push) Successful in 5s
build-and-push / sonar (push) Successful in 11s
build-and-push / docker (push) Successful in 1m12s

This commit is contained in:
nocci 2025-12-31 11:13:39 +00:00
parent 0340873d91
commit 7f5226ea65

View file

@ -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). # Firefox profile directory (persistent if writable; fallback to cache when bind-mount is read-only).
BROWSER_DIR=/fgc/data/browser BROWSER_DIR=/fgc/data/browser
mkdir -p "$BROWSER_DIR" 2>/dev/null || true
if [ ! -w "$BROWSER_DIR" ]; then if [ ! -w "$BROWSER_DIR" ]; then
echo "Warning: $BROWSER_DIR not writable; using fallback profile at /home/fgc/.cache/browser" echo "Warning: $BROWSER_DIR not writable; using fallback profile at /home/fgc/.cache/browser"
BROWSER_DIR=/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 chown 1000:1000 "$BROWSER_DIR" 2>/dev/null || true
fi 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" # 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 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 # Firefox preferences are stored in $BROWSER_DIR/pref.js and can be overridden by a file user.js