#
# This script creates the HAL system user/group.
#

case "$2" in
pre)
	;;
post)
	echo "Running $3-$4 post installation hooks..."
	if ! chroot . getent group hal >/dev/null; then
		chroot . groupadd -r hal
		[ $? -ne 0 ] && exit $?
		echo "Created HAL system group."
	fi
	if ! chroot . getent passwd hal >/dev/null; then
		chroot . useradd -c "HAL daemon" \
			-d / -s /sbin/nologin -g hal \
			-G optical,floppy,storage -r hal && \
		chroot . passwd -l hal &>/dev/null
		[ $? -ne 0 ] && exit $?
		echo "Created HAL system user."
	fi
	;;
esac