zapretgui/packaging/linux/deb/postinst
loop-uh b44e2f1f85
All checks were successful
Zapret source guards / validate (push) Successful in 16s
Windows-сборка / Dev Dev 21.1.7.297 опубликован
Linux packaging: the scripts are executable in git, and the AppImage start does not rely on it
Dev 296 was built from a git export of the commit, where install.sh, uninstall.sh, AppRun, bin/* and the deb scripts were stored as 100644 (local builds had the bit set by hand, so every test on the build machine passed). The AppImage carried a non-executable install.sh: its first start died on every desktop with sudo: install.sh: command not found (pkexec the same), nothing was installed and the window never opened. Now the modes are 100755 in git and AppRun makes its temporary copy of install.sh/uninstall.sh executable itself. Two tests (the git index modes; the chmod in AppRun), both fail on the old state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:43:03 -05:00

22 lines
1.1 KiB
Shell
Executable file

#!/bin/sh
set -e
# The person who installed (sudo or pkexec) is added to the group that may talk to the helper; others add themselves:
# sudo usermod -aG zapretgui NAME
if [ "$1" = configure ]; then
getent group zapretgui >/dev/null || groupadd --system zapretgui
WHO="${SUDO_USER:-}"
[ -z "$WHO" ] && [ -n "${PKEXEC_UID:-}" ] && WHO="$(getent passwd "$PKEXEC_UID" | cut -d: -f1)"
if [ -n "$WHO" ] && [ "$WHO" != root ] && id "$WHO" >/dev/null 2>&1; then
usermod -aG zapretgui "$WHO" && echo "zapretgui: $WHO was added to the group zapretgui (log in again for it to apply)"
else
echo "zapretgui: add each person who uses it to the group: sudo usermod -aG zapretgui NAME"
fi
command -v update-desktop-database >/dev/null && update-desktop-database -q /usr/share/applications || true
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -q /usr/share/icons/hicolor || true
if [ -d /run/systemd/system ]; then
systemctl daemon-reload || true
systemctl enable zapretgui-helper.service || true
systemctl restart zapretgui-helper.service || true
fi
fi
exit 0