PREIN
/bin/sh
if [ $1 -eq 1 ] ; then
getent group nocpulse >/dev/null || groupadd -r nocpulse
getent passwd nocpulse >/dev/null || \
useradd -r -g nocpulse -d /var/lib/nocpulse -c "NOCpulse user" nocpulse
/usr/bin/passwd -l nocpulse >/dev/null
exit 0
fi
# Old NOCpulse packages has home in /home/nocpulse.
# We need to migrate them to new place.
if getent passwd nocpulse >/dev/null && [ -d /home/nocpulse ]; then
/usr/sbin/usermod -d /var/lib/nocpulse -m nocpulse
rm -rf /var/lib/nocpulse/bin
rm -rf /var/lib/nocpulse/var
fi
PREUN
/bin/sh
if [ $1 = 0 ]; then
/sbin/service rhnmd stop > /dev/null 2>&1
/sbin/chkconfig --del rhnmd
fi
POSTIN
/bin/sh
if [ ! -f /var/lib/nocpulse/.ssh/nocpulse-identity ]
then
/sbin/runuser -s /bin/bash -c "/usr/bin/ssh-keygen -q -t dsa -N '' -f /var/lib/nocpulse/.ssh/nocpulse-identity" - nocpulse
fi
/sbin/chkconfig --add rhnmd