mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-13 03:03:15 +00:00
937b77e48d
PR: ports/81829 Submitted by: Janos Mohacsi <janos.mohacsi@bsd.hu> (maintainer)
43 lines
753 B
Bash
43 lines
753 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# Based on cyrus-sasl2 port
|
|
#
|
|
# create 'flowd' user
|
|
#
|
|
|
|
create_user() {
|
|
USER=${FLOWD_USER}
|
|
GROUP=nobody
|
|
PW=/usr/sbin/pw
|
|
|
|
if [ -x /usr/sbin/nologin ]; then
|
|
shell=/usr/sbin/nologin
|
|
elif [ -x /sbin/nologin ]; then
|
|
shell=/sbin/nologin
|
|
else
|
|
shell=/nonexistent
|
|
fi
|
|
uhome="/var/empty"
|
|
|
|
if ! ${PW} show user ${USER} -q >/dev/null; then
|
|
if ! ${PW} add user ${USER} -g ${GROUP} -d "${uhome}" \
|
|
-c "flowd privilege separation user" -s "${shell}" -p "*" \
|
|
; then
|
|
e=$?
|
|
echo "*** Failed to add user \`${USER}'. Please add it manually."
|
|
exit ${e}
|
|
fi
|
|
echo "*** Added user \`${USER}' (id ${uid})"
|
|
else
|
|
echo "*** You already have user \`${USER}'."
|
|
fi
|
|
}
|
|
|
|
case $2 in
|
|
POST-INSTALL)
|
|
create_user
|
|
;;
|
|
esac
|