freebsd-ports/net/rtpproxy/pkg-install
Maxim Sobolev fd17cc1963 Add unprivileged user to run under, so it's more secure.
Reminded by:    Olle E. Johansson
2012-12-12 02:08:33 +00:00

35 lines
744 B
Bash

#!/bin/sh
# $FreeBSD$
#
if [ "$2" != "PRE-INSTALL" ]; then
exit 0
fi
RTPPROXY_USER=rtpproxy
RTPPROXY_GROUP=${RTPPROXY_USER}
RTPPROXY_UID=222
RTPPROXY_GID=${RTPPROXY_UID}
if ! pw groupshow "${RTPPROXY_GROUP}" 2>/dev/null 1>&2; then
if pw groupadd ${RTPPROXY_GROUP} -g ${RTPPROXY_GID}; then
echo "Added group \"${RTPPROXY_GROUP}\"."
else
echo "Adding group \"${RTPPROXY_GROUP}\" failed..."
exit 1
fi
fi
if ! pw usershow "${RTPPROXY_USER}" 2>/dev/null 1>&2; then
if pw useradd ${RTPPROXY_USER} -u ${RTPPROXY_UID} -g ${RTPPROXY_GROUP} -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "RTP Proxy"; \
then
echo "Added user \"${RTPPROXY_USER}\"."
else
echo "Adding user \"${RTPPROXY_USER}\" failed..."
exit 1
fi
fi
exit 0