#!/bin/sh

TRIRCD_USER="trircd"
TRIRCD_GROUP="trircd"
TRIRCD_RUNDIR="/var/run/tr-ircd"
TRIRCD_LOGDIR="/var/log/tr-ircd"
TRIRCD_CONFDIR="/usr/local/etc/tr-ircd"

MKDIR="/bin/mkdir -p"
PW="/usr/sbin/pw"

if ! ${PW} groupshow "${TRIRCD_GROUP}" 2>/dev/null 1>&2; then
        if pw groupadd ${TRIRCD_GROUP}; then
                echo "Added group \"${TRIRCD_GROUP}\"."
        else
                echo "Adding group \"${TRIRCD_GROUP}\" failed..."
                exit 1
        fi
else
	echo "You already have a group \"${TRIRCD_GROUP}\"."
fi

if ! ${PW} usershow "${TRIRCD_USER}" 2>/dev/null 1>&2; then
        if pw useradd ${TRIRCD_USER} -g ${TRIRCD_GROUP} -h - \
                -s "/usr/sbin/nologin" -d "/usr/local/etc/tr-ircd" \
                -c "TR-IRCD pseudo-user"; \
        then
                echo "Added user \"${TRIRCD_USER}\"."
        else
                echo "Adding user \"${TRIRCD_USER}\" failed..."
                exit 1
        fi
else
	echo "You already have a user \"${TRIRCD_USER}\"."
fi


syntax highlighted by Code2HTML, v. 0.9.1