#!/bin/sh
# Firefox enterprise policy plumbing for the general-browsing window. Identical logic
# to hosts/thin-client's 0900-firefox.hook.chroot.
set -eu

FIREFOX_LIB_DIR="/usr/lib/firefox-esr"

if [ -d "$FIREFOX_LIB_DIR" ]; then
  mkdir -p "$FIREFOX_LIB_DIR/distribution"
  ln -sf /etc/firefox/policies/policies.json "$FIREFOX_LIB_DIR/distribution/policies.json"
  echo "0600-firefox: linked policies.json into $FIREFOX_LIB_DIR/distribution/"
else
  echo "0600-firefox: $FIREFOX_LIB_DIR not found (firefox-esr not installed yet, or a"
  echo "  different path in this Debian release) — /etc/firefox/policies/policies.json"
  echo "  still applies if the package's install order runs after this hook; verify"
  echo "  about:policies shows uBlock Origin/SponsorBlock as force-installed on first boot."
fi
