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>
15 lines
743 B
Shell
Executable file
15 lines
743 B
Shell
Executable file
#!/bin/sh
|
|
set -e
|
|
if [ "$1" = remove ] || [ "$1" = upgrade ] || [ "$1" = deconfigure ]; then
|
|
if [ -r /opt/zapretgui/initsys.sh ]; then
|
|
. /opt/zapretgui/initsys.sh
|
|
# remove: stop and take the service out (init scripts included); upgrade: only stop, postinst starts it again
|
|
if [ "$1" = remove ]; then zg_service_remove || true; else zg_service_stop || true; fi
|
|
elif [ -d /run/systemd/system ]; then
|
|
systemctl stop zapretgui-helper.service || true
|
|
[ "$1" = remove ] && systemctl disable zapretgui-helper.service || true
|
|
fi
|
|
# the helper removes its table when it stops; this is the second net, so no rule outlives the program
|
|
command -v nft >/dev/null && nft delete table inet zapretgui 2>/dev/null || true
|
|
fi
|
|
exit 0
|