PREIN
/bin/sh
getent group haproxy >/dev/null || \
groupadd -r haproxy
getent passwd haproxy >/dev/null || \
useradd -r -g haproxy -d /var/lib/haproxy \
-s /sbin/nologin -c "haproxy" haproxy
exit 0
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
systemctl --no-reload disable haproxy.service > /dev/null 2>&1 || :
systemctl stop haproxy.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset haproxy.service >/dev/null 2>&1 || :
fi
POSTUN
/bin/sh
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
systemctl try-restart haproxy.service >/dev/null 2>&1 || :
fi