#! /bin/sh # $FreeBSD$ WITH_YULE="%%WITH_YULE%%" make_account() { local u g gcos homeopt u=$1 g=$2 gcos=$3 homeopt=${4:+"-d $4"} if pw group show "${g}" >/dev/null 2>&1; then echo "You already have a group \"${g}\", so I will use it." else if which -s pw; then pw groupadd ${g} || exit echo "Added group ${g}." else echo "Adding group ${g} failed. Please create it, and try again." if ! grep -q "^${u}:" /etc/passwd; then echo "While you're at it, please create a user \"${u}\" too," echo "with a default group of \"${g}\"." fi exit 1 fi fi if pw user show "${u}" >/dev/null 2>&1; then echo "You already have a user \"${u}\", so I will use it." else if which -s pw; then pw useradd ${u} -g ${g} -h - ${homeopt} \ -s /nonexistent -c "${gcos}" || exit echo "Added user ${u}." else echo "Adding user ${u} failed. Please create it, and try again." exit 1 fi fi } case $2 in PRE-INSTALL) if [ x${WITH_YULE} = xyes ]; then make_account yule yule "yule" "/nonexistent" fi ;; esac