a75b9780d3
- Fix some missed includes to avoid warnings - Bump portrevision Submitted by: "Ryan T. Dean" <rtdean@cytherianage.net> (based on) [1]
78 lines
1.6 KiB
Bash
78 lines
1.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin
|
|
|
|
FLOW_CAPTURE_SPOOL="%%FLOW_CAPTURE_SPOOL%%"
|
|
FLOW_CAPTURE_USER="%%FLOW_CAPTURE_USER%%"
|
|
FLOW_CAPTURE_GROUP="%%FLOW_CAPTURE_GROUP%%"
|
|
FLOW_CAPTURE_PIDDIR="%%FLOW_CAPTURE_PIDDIR%%"
|
|
|
|
if [ -x /usr/sbin/nologin ]; then
|
|
NOLOGIN=/usr/sbin/nologin
|
|
else
|
|
NOLOGIN=/sbin/nologin
|
|
fi
|
|
|
|
pre-install() {
|
|
#
|
|
# Create group
|
|
#
|
|
pw groupshow ${FLOW_CAPTURE_GROUP} > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo -n "Creating '${FLOW_CAPTURE_GROUP}' group... "
|
|
pw groupadd ${FLOW_CAPTURE_GROUP} -q
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "ok"
|
|
else
|
|
echo "failed"
|
|
echo "Cannot create group '${FLOW_CAPTURE_GROUP}'" >&2
|
|
echo "Please, create it manually." >&2
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Using existing group '${FLOW_CAPTURE_GROUP}'"
|
|
fi
|
|
|
|
#
|
|
# Create user
|
|
#
|
|
pw usershow ${FLOW_CAPTURE_USER} > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo -n "Creating '${FLOW_CAPTURE_USER}' user... "
|
|
pw useradd -n ${FLOW_CAPTURE_USER} -g ${FLOW_CAPTURE_GROUP} \
|
|
-c "Flow-tools collector pseudo-user" \
|
|
-d "/var/empty" -s "${NOLOGIN}" -h - -q
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "ok"
|
|
else
|
|
echo "failed"
|
|
echo "Cannot create user '${FLOW_CAPTURE_USER}'" >&2
|
|
echo "Please, create it manually." >&2
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Using existing group '${FLOW_CAPTURE_USER}'"
|
|
fi
|
|
}
|
|
|
|
post-install() {
|
|
/usr/bin/install -d -m 700 -o ${FLOW_CAPTURE_USER} \
|
|
-g ${FLOW_CAPTURE_GROUP} ${FLOW_CAPTURE_PIDDIR}
|
|
/usr/bin/install -d -m 1700 -o ${FLOW_CAPTURE_USER} \
|
|
-g ${FLOW_CAPTURE_GROUP} ${FLOW_CAPTURE_SPOOL}
|
|
}
|
|
|
|
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
pre-install
|
|
;;
|
|
POST-INSTALL)
|
|
post-install
|
|
;;
|
|
esac
|