PREIN
/bin/sh
if [ -n "`/usr/bin/getgid djbdns`" ]; then
if [ "`/usr/bin/getgid djbdns`" != "32" ]; then
echo "Error: group djbdns doesn't have gid=32. Correct this before installing pdns." 1>&2
exit 1
fi
else
echo "Adding group djbdns GID=32."
/usr/sbin/groupadd -g 32 -r djbdns 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u pdns 2>/dev/null`" ]; then
if [ "`/bin/id -u pdns`" != "30" ]; then
echo "Error: user pdns doesn't have uid=30. Correct this before installing pdns." 1>&2
exit 1
fi
else
echo "Adding user pdns UID=30."
/usr/sbin/useradd \
\
-u 30 \
-r \
-d /var/lib/pdns \
-s /bin/false \
-c "pdns User"\
-g djbdns \
\
\
pdns 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ -f /var/lock/subsys/pdns ]; then
/sbin/service pdns stop 1>&2 || :;
fi }; /sbin/chkconfig --del pdns
fi
POSTIN
/bin/sh
# dirty hack so the config file is processed correctly, and server does not respawn
sed -i -e 's/^ *//' /etc/pdns/pdns.conf
/sbin/chkconfig --add pdns
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/pdns ] && . /etc/sysconfig/pdns
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/pdns ]; then
/sbin/service pdns restart 1>&2 || :;
else
echo 'Run "/sbin/service pdns start" to start pdns service.'
fi
fi };
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del pdns
/usr/lib/rpm/user_group.sh group del djbdns
fi