Files
rust-package-builder/opnsense/plugin/src/etc/rc.syshook.d/start/50-rustproxy.start
T

20 lines
802 B
Bash
Executable File

#!/bin/sh
# OPNsense invokes this hook after networking and configd are available.
# Regenerate from config.xml on every boot: /var and /usr/local/etc may have
# been restored, or the administrator may have changed the GUI settings.
# Retry briefly if configd is still finishing startup on slower firewalls.
attempt=1
while ! /usr/local/sbin/configctl template reload OPNsense/RustProxy; do
if [ "$attempt" -ge 3 ]; then
echo "RustProxy: failed to render configuration during boot (3 attempts)" >&2
exit 1
fi
attempt=$((attempt + 1))
/bin/sleep 2
done
# Use the helper directly: its enabled check is based on the freshly rendered
# configuration and it does not rely on configd reloading our action registry.
exec /usr/local/opnsense/scripts/rustproxy/service.sh boot