#!/sbin/openrc-run # shellcheck shell=sh instance=${RC_SVCNAME#*.} description="Nuke HTTP defense proxy (instance ${instance})" supervisor="supervise-daemon" command="/usr/bin/nuke" command_args="\ -bind ${NUKE_BIND_PORT:-/run/nuke_${instance?}/nuke.sock -bind-network unix} \ -metrics-bind ${NUKE_METRICS_BIND_PORT:-/run/nuke_${instance?}/metrics.sock -metrics-bind-network unix} \ -target ${NUKE_TARGET:-http://localhost:3923} \ -difficulty ${NUKE_DIFFICULTY:-4} \ ${NUKE_OPTS} " command_background=1 pidfile="/run/nuke_${instance?}/nuke.pid" : "${command_user:=nuke:nuke}" depend() { use net firewall } start_pre() { if [ "${instance?}" = "${RC_SVCNAME?}" ]; then eerror "${RC_SVCNAME?} cannot be started directly. You must create" eerror "symbolic links to it for the services you want to start" eerror "and add those to the appropriate runlevels." return 1 fi rm -rf "/run/nuke_${instance?}" checkpath -D -o "${command_user?}" "/run/nuke_${instance?}" }