# Hook for opensmtpd

run_hook_opensmtpd() {
	local dir="etc/mail"
	# Create missing directories
	[ -d ${CHROOT}/${dir} ] || mkdir ${CHROOT}/${dir}
	dir="var/spool"
	[ -d ${CHROOT}/${dir} ] || ${AS_ROOT} mkdir -p ${CHROOT}/${dir}

	# pkg info --raw opensmtpd
	${AS_ROOT} pw -R ${CHROOT} groupadd _smtpd -g 257
	${AS_ROOT} pw -R ${CHROOT} groupadd _smtpq -g 258
	${AS_ROOT} pw -R ${CHROOT} useradd  _smtpd -u 257 -g 257 -d /var/empty -s /usr/sbin/nologin -c "OpenSMTPD"
	${AS_ROOT} pw -R ${CHROOT} useradd  _smtpq -u 258 -g 258 -d /var/empty -s /usr/sbin/nologin -c "OpenSMTPD queue user"

	${AS_ROOT} pw -R ${CHROOT} groupadd vmail -g 2000
	${AS_ROOT} pw -R ${CHROOT} useradd  vmail -u 2000 -g 2000 -d /var/empty -s /usr/sbin/nologin -c "OpenSMTPD virtual user"
}

run_hook_opensmtpd
# vim:set sw=4 sts=4 ts=4 ft=sh :
