freebsd-ports/net-mgmt/cacti/pkg-install
Pav Lucistnik 5b92ee5df5 Add cacti, a PHP based frontend to RRDtool configuration.
PR:		ports/59996
Submitted by:	Vincent Tantardini <vinc@freebsd-fr.org>
2003-12-21 17:01:41 +00:00

43 lines
877 B
Bash

#!/bin/sh
PW=/usr/sbin/pw
case $2 in
PRE-INSTALL)
if ${PW} group show "${CACTIGROUP}" 2>/dev/null; then
echo "You already have a group \"${CACTIGROUP}\", so I will use it."
else
if ${PW} groupadd ${CACTIGROUP}; then
echo "Added group \"${CACTIGROUP}\"."
else
echo "Adding group \"${CACTIGROUP}\" failed..."
exit 1
fi
fi
if ${PW} user show "${CACTIUSER}" 2>/dev/null; then
echo "You already have a user \"${CACTIUSER}\", so I will use it."
else
if ${PW} useradd ${CACTIUSER} -g ${CACTIGROUP} -h - \
-d "/nonexistent" -s /sbin/nologin -c "Cacti Sandbox"
then
echo "Added user \"${CACTIUSER}\"."
else
echo "Adding user \"${CACTIUSER}\" failed..."
exit 1
fi
fi
;;
POST-INSTALL)
chown ${CACTIUSER}:${CACTIGROUP} ${PREFIX}/${CACTIDIR}/log/
chown ${CACTIUSER}:${CACTIGROUP} ${PREFIX}/${CACTIDIR}/rra/
;;
*)
exit 1
;;
esac
exit