freebsd-ports/misc/dnetc/pkg-install
Daniel Baker 73aebacf35 Create a "dnetc" user and group that owns relevant dnetc
directories, files, and runs the client.

This removes all reliance on the "nobody" account so that the account
doesn't own any files or run any processes.
2001-12-04 01:43:20 +00:00

32 lines
811 B
Bash

#!/bin/sh
if [ "$2" != "PRE-INSTALL" ]; then
exit 0
fi
CLIENTUSER=$3
CLIENTUID=$4
CLIENTGROUP=$5
CLIENTGID=$6
if ! pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
if pw groupadd $CLIENTGROUP -g $CLIENTGID; then
echo "=> Added group \"$CLIENTGROUP\"."
else
echo "=> Adding group \"$CLIENTGROUP\" failed..."
exit 1
fi
fi
if ! pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
if pw useradd $CLIENTUSER -u $CLIENTUID -g $CLIENTGROUP -h - \
-s "/sbin/nologin" -d "/nonexistent" \
-c "distributed.net client and proxy pseudo-user"; \
then
echo "=> Added user \"$CLIENTUSER\"."
else
echo "=> Adding user \"$CLIENTUSER\" failed..."
exit 1
fi
fi
exit 0