zapretgui/packaging/linux/init/zapretgui-helper.openrc
loop-uh 9edcd342a1
All checks were successful
Zapret source guards / validate (push) Successful in 9s
Windows-сборка / Dev Dev 21.1.7.304 опубликован
Linux: the helper service works under systemd, OpenRC and sysvinit (Devuan), chosen by the machine itself
initsys.sh finds the init system (running systemd, then OpenRC, then sysvinit, else none) and installs/starts/stops/removes the service
for it: the unit, an openrc-run script or an LSB script. install.sh, uninstall.sh and the .deb scripts use it; the .deb no longer
depends on systemd; the AppImage asks for the helper's socket instead of systemctl; hints in the program name the command of the
init system found. The OpenRC and the sysv scripts were run for real (Debian 13 chroot with OpenRC, start-stop-daemon).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 09:04:01 -05:00

28 lines
1.1 KiB
Text
Executable file

#!/sbin/openrc-run
# For OpenRC (Devuan with OpenRC, Alpine, Gentoo, Artix). packaging/linux/initsys.sh installs it as /etc/init.d/zapretgui-helper.
description="Zapret helper: firewall rules and the nfqws2 engine for the Zapret window"
command="${ZAPRETGUI_PREFIX:-/opt/zapretgui}/bin/zapretgui-helper"
command_background=true
pidfile="${ZAPRETGUI_PIDFILE:-/run/zapretgui-helper.pid}"
output_log="${ZAPRETGUI_LOGFILE:-/var/log/zapretgui-helper.log}"
error_log="${ZAPRETGUI_LOGFILE:-/var/log/zapretgui-helper.log}"
socket="${ZAPRETGUI_SOCKET:-/run/zapretgui/helper.sock}"
depend() {
use localmount logger
}
# The helper removes its own table on every way out; these two are the second net for a helper that was killed hard
# (ExecStartPre / ExecStopPost of the systemd unit): the table is never left behind to cut the internet.
start_pre() {
command -v nft >/dev/null 2>&1 && nft delete table inet zapretgui 2>/dev/null
checkpath --directory --mode 0755 "$(dirname "$socket")"
return 0
}
stop_post() {
rm -f "$socket"
command -v nft >/dev/null 2>&1 && nft delete table inet zapretgui 2>/dev/null
return 0
}