#!/bin/sh
#
# $FreeBSD: ports/mail/popfile/files/popfile.sh,v 1.3 2004/03/27 05:19:40 matusita Exp $
#
case "${HOME}" in
"")
	export POPFILE_USER_DEFAULT=/var/db/popfile
	;;
*)
	export POPFILE_USER_DEFAULT="${HOME}/.popfile"
	;;
esac

die()
{
	echo "$1"
	exit 1
}

export POPFILE_ROOT=/usr/local/share/popfile
export POPFILE_USER=${POPFILE_USER:-${POPFILE_USER_DEFAULT}}

mkdir -p "${POPFILE_USER}" || die "mkdir ${POPFILE_USER} failed"
cd "${POPFILE_USER}"
/usr/local/share/popfile/popfile.pl >/dev/null 2>&1 &
