PREIN
/bin/sh
getent group cockpit-ws >/dev/null || groupadd -r cockpit-ws
getent passwd cockpit-ws >/dev/null || useradd -r -g cockpit-ws -d /nonexisting -s /sbin/nologin -c "User for cockpit web service" cockpit-ws
getent group cockpit-wsinstance >/dev/null || groupadd -r cockpit-wsinstance
getent passwd cockpit-wsinstance >/dev/null || useradd -r -g cockpit-wsinstance -d /nonexisting -s /sbin/nologin -c "User for cockpit-ws instances" cockpit-wsinstance
PREUN
/bin/sh
if [ $1 -eq 0 ] && [ -x /usr/bin/systemctl ]; then
# Package removal, not upgrade
/usr/bin/systemctl --no-reload disable --now cockpit.socket || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] && [ -x /usr/bin/systemctl ]; then
# Initial installation
/usr/bin/systemctl --no-reload preset cockpit.socket || :
fi
# firewalld only partially picks up changes to its services files without this
test -f /usr/bin/firewall-cmd && firewall-cmd --reload --quiet || true
POSTUN
/bin/sh
if [ $1 -ge 1 ] && [ -x /usr/bin/systemctl ]; then
# Package upgrade, not uninstall
/usr/bin/systemctl try-restart cockpit.socket || :
fi
if [ $1 -ge 1 ] && [ -x /usr/bin/systemctl ]; then
# Package upgrade, not uninstall
/usr/bin/systemctl try-restart cockpit.service || :
fi
# -------------------------------------------------------------------------------
# Sub-packages that are part of cockpit-system in RHEL/CentOS, but separate in Fedora