Files
rustproxy-opnsense-repo/deploy/opnsense/install-direct.sh
T
2026-09-29 14:07:21 +02:00

44 lines
939 B
Bash
Executable File

#!/bin/sh
set -eu
if [ "$(id -u)" -ne 0 ]; then
echo "Run as root on OPNsense" >&2
exit 1
fi
source_pkg="${1:-}"
if [ -z "$source_pkg" ]; then
echo "usage: $0 </path/to/os-rustproxy.pkg|https://.../os-rustproxy.pkg>" >&2
exit 64
fi
tmp=""
case "$source_pkg" in
http://*|https://*)
tmp="/tmp/os-rustproxy-install.pkg"
fetch -o "$tmp" "$source_pkg"
package="$tmp"
;;
*)
package="$source_pkg"
;;
esac
if [ ! -f "$package" ]; then
echo "Package not found: $package" >&2
exit 1
fi
pkg add -f "$package"
# New configd action files are loaded only after configd is restarted.
service configd restart
/usr/local/sbin/pluginctl -cq cache_flush >/dev/null 2>&1 || true
/usr/local/sbin/configctl template reload OPNsense/RustProxy >/dev/null 2>&1 || true
if [ -n "$tmp" ]; then
rm -f "$tmp"
fi
echo "RustProxy package installed. Open Services -> RustProxy."