#!/bin/sh

SVCCFG=/usr/sbin/svccfg
GREP=/usr/bin/grep
USERDEL=/usr/sbin/userdel
GROUPDEL=/usr/sbin/groupdel
fmri=svc:/application/network/icinga:default

${SVCCFG} delete -f ${fmri}

${GREP} icinga /etc/passwd > /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
        ${USERDEL} -r icinga
fi

${GREP} icinga /etc/group > /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
        ${GROUPDEL} icinga
fi

exit 0
