#!/bin/sh

# Live USB fallback: loader.conf should load mac_do, but some live boot paths
# may skip the normal loader/module path. Best-effort load before autostarted
# tools such as NetworkMgr try to use mdo.
kldload mac_do 2>/dev/null || true
_desired_mac_do_rules='gid=0>uid=0,gid=0,+gid=*'
if [ "$(sysctl -n security.mac.do.rules 2>/dev/null || true)" != "${_desired_mac_do_rules}" ]; then
    sysctl security.mac.do.rules="${_desired_mac_do_rules}" 2>/dev/null || true
fi

# Belt-and-suspenders for xorg.conf.d/40-clawdie-noblank.conf. The
# server-level ServerFlags should already suppress blanking + DPMS,
# but if a future X build ignores one option, the session-level xset
# calls still disable the timers. Harmless if already off.
xset s off 2>/dev/null || true
xset -dpms 2>/dev/null || true
xset s noblank 2>/dev/null || true
if [ -x /usr/local/bin/clawdie-noblank-guard.sh ]; then
    /usr/local/bin/clawdie-noblank-guard.sh >/dev/null 2>&1 &
fi
