PREIN
/bin/sh
getent group unbound >/dev/null || groupadd -r unbound
getent passwd unbound >/dev/null || \
useradd -r -g unbound -d /etc/unbound -s /sbin/nologin \
-c "Unbound DNS resolver" unbound
exit 0
PREUN
/bin/sh
if [ "$1" -eq 0 ]; then
/sbin/service unbound stop >/dev/null 2>&1
/sbin/chkconfig --del unbound
fi
POSTIN
/bin/sh
/sbin/chkconfig --add unbound
# dnssec-conf used to contain our DLV key, but now we include it via unbound
# If unbound had previously been configured with dnssec-configure, we need
# to migrate the location of the DLV key file (to keep DLV enabled, and because
# unbound won't start with a bad location for a DLV key file.
sed -i "s:/etc/pki/dnssec-keys[/]*dlv:/etc/unbound:" /etc/unbound/unbound.conf
POSTUN
/bin/sh
if [ "$1" -ge "1" ]; then
/sbin/service unbound condrestart >/dev/null 2>&1 || :
fi