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>
18 lines
877 B
Shell
Executable file
18 lines
877 B
Shell
Executable file
#!/bin/sh
|
|
set -e
|
|
if [ "$1" = remove ] || [ "$1" = purge ]; then
|
|
[ -d /run/systemd/system ] && systemctl daemon-reload || true
|
|
command -v update-desktop-database >/dev/null && update-desktop-database -q /usr/share/applications || true
|
|
fi
|
|
if [ "$1" = purge ]; then
|
|
rm -rf /run/zapretgui
|
|
rm -f /var/log/zapretgui-helper.log /run/zapretgui-helper.pid
|
|
getent group zapretgui >/dev/null && groupdel zapretgui 2>/dev/null || true
|
|
# the copy of /etc/hosts from before the first change made by the program: removed with the program, unless /etc/hosts
|
|
# still differs from it (then it is the only way back, and it stays)
|
|
if [ -f /var/lib/zapretgui/hosts.original ] && cmp -s /var/lib/zapretgui/hosts.original /etc/hosts; then
|
|
rm -rf /var/lib/zapretgui
|
|
fi
|
|
# the data of each person (~/.config/zapretgui, ~/.local/share/zapretgui ...) is theirs and stays
|
|
fi
|
|
exit 0
|