mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-23 17:21:56 +02:00
Update wrapped-chromium
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
# Prefer the real chromium binary used by LSIO images; fall back safely.
|
# Resolve chromium binary (LSIO uses this path)
|
||||||
if [[ -x /usr/lib/chromium/chromium ]]; then
|
if [[ -x /usr/lib/chromium/chromium ]]; then
|
||||||
BIN=/usr/lib/chromium/chromium
|
BIN=/usr/lib/chromium/chromium
|
||||||
elif command -v chromium >/dev/null 2>&1; then
|
elif command -v chromium >/dev/null 2>&1; then
|
||||||
@@ -13,32 +13,39 @@ else
|
|||||||
exit 127
|
exit 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pick a deterministic profile dir (LSIO commonly sets HOME=/config).
|
# Fixed profile dir as requested
|
||||||
HOME_DIR="${HOME:-/config}"
|
USER_DATA_DIR="/data/profile"
|
||||||
USER_DATA_DIR="${CHROME_USER_DATA_DIR:-${HOME_DIR}/.config/chromium}"
|
|
||||||
|
|
||||||
mkdir -p "${USER_DATA_DIR}"
|
mkdir -p "${USER_DATA_DIR}"
|
||||||
|
|
||||||
# Cleanup stale singleton locks only if chromium is not running
|
# Cleanup stale locks if chromium is not already running
|
||||||
if ! pgrep -f 'chromium' >/dev/null 2>&1; then
|
if ! pgrep -f 'chromium' >/dev/null 2>&1; then
|
||||||
rm -f "${USER_DATA_DIR}/Singleton"* || true
|
rm -f "${USER_DATA_DIR}/Singleton"* || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect seccomp mode properly (0=disabled). This is still a heuristic.
|
# Detect seccomp mode (0 = disabled)
|
||||||
seccomp_mode="$(awk -F':' '/^Seccomp:/{gsub(/[[:space:]]/,"",$2); print $2}' /proc/1/status || echo "")"
|
seccomp_mode="$(awk -F':' '/^Seccomp:/{gsub(/[[:space:]]/,"",$2); print $2}' /proc/1/status || echo "")"
|
||||||
|
|
||||||
|
# Base arguments (exactly what you requested + required safety flags)
|
||||||
args=(
|
args=(
|
||||||
|
--remote-debugging-address=0.0.0.0
|
||||||
|
--remote-debugging-port=9221
|
||||||
|
--user-data-dir="${USER_DATA_DIR}"
|
||||||
|
--disable-dev-shm-usage
|
||||||
--no-first-run
|
--no-first-run
|
||||||
|
--no-default-browser-check
|
||||||
|
--disable-background-networking
|
||||||
|
--disable-sync
|
||||||
--password-store=basic
|
--password-store=basic
|
||||||
"--simulate-outdated-no-au=Tue, 31 Dec 2099 23:59:59 GMT"
|
"--simulate-outdated-no-au=Tue, 31 Dec 2099 23:59:59 GMT"
|
||||||
--start-maximized
|
--start-maximized
|
||||||
"--user-data-dir=${USER_DATA_DIR}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# If seccomp is not disabled, sandboxing often breaks in containers; use no-sandbox.
|
# Container reality: sandbox usually breaks unless seccomp is fully disabled
|
||||||
if [[ "${seccomp_mode}" != "0" ]]; then
|
if [[ "${seccomp_mode}" != "0" ]]; then
|
||||||
args+=( --no-sandbox --test-type )
|
args+=( --no-sandbox --test-type )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# IMPORTANT: do NOT redirect to /dev/null while debugging
|
# IMPORTANT:
|
||||||
|
# - no output redirection
|
||||||
|
# - exec replaces PID 1 cleanly
|
||||||
exec "${BIN}" "${args[@]}" "$@"
|
exec "${BIN}" "${args[@]}" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user