PREIN
/bin/sh
# http://fedoraproject.org/wiki/Packaging%3aUsersAndGroups
# "We never remove users or groups created by packages"
getent group orthanc >/dev/null || groupadd -r orthanc
getent passwd orthanc >/dev/null || \
useradd -r -g orthanc -G orthanc -d /var/lib/orthanc -s /sbin/nologin \
-c "User account that holds information for Orthanc" orthanc
exit 0
PREUN
/bin/sh
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/usr/bin/systemctl --no-reload disable orthanc.service > /dev/null 2>&1 || :
/usr/bin/systemctl stop orthanc.service > /dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ $1 -eq 1 ] ; then
# Initial installation
/usr/bin/systemctl preset orthanc.service >/dev/null 2>&1 || :
fi
POSTUN
/bin/sh
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/usr/bin/systemctl try-restart orthanc.service >/dev/null 2>&1 || :
fi