1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00
freebsd-ports/net/cacti/files/pkg-install.in
Sergey Matveychuk badc834778 - Fix removing logic for user config [1]
- Remove useless empty dirs
- Fix package
- Makefile refactoring
- Utilize SUB_FILES magic
- Update pkg-message

Reported by:    kris (via pointyhat) [1]
2005-04-21 07:02:05 +00:00

51 lines
1.0 KiB
Bash

#!/bin/sh
PW=/usr/sbin/pw
UID=107
GID=${UID}
CACTIUSER=%%CACTIUSER%%
CACTIGROUP=%%CACTIGROUP%%
CACTIDIR=%%CACTIDIR%%
PREFIX=%%PREFIX%%
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} -g ${GID}; 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} -u ${UID} -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}/log/*
chown ${CACTIUSER}:${CACTIGROUP} ${PREFIX}/${CACTIDIR}/rra/
;;
*)
exit 1
;;
esac
exit