freebsd-ports/mail/p5-Mail-SpamAssassin/pkg-install
Sergey Matveychuk dc2973ac8a - Update to 3.0.3 (1)
- Don't run spamd from root anymore. Use spamd user instead.
  Put PID file in /var/run/spamd/ as result.
- A patch for fixing spamd that did not drop privileges for children (2)
- Rename SQL variable to more clean SQL_FLAG.

PR:		ports/80556 (1)
Submitted by:	Linh Pham <question+fbsdports@closedsrc.org> (1)
		Brandon Kuczenski <brandon@301south.net> (perl@) (2)
Obtained from:	http://bugzilla.spamassassin.org/show_bug.cgi?id=3897 (2)
2005-05-06 20:05:57 +00:00

38 lines
739 B
Bash

#!/bin/sh
if [ "$2" != "PRE-INSTALL" ]; then
exit 0
fi
USER=spamd
GROUP=${USER}
UID=58
GID=${UID}
HOME=/var/spool/${USER}
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
if pw groupadd ${GROUP} -g ${GID}; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-s "/sbin/nologin" -d "${HOME}" \
-c "SpamAssassin user"; \
then
echo "Added user \"${USER}\"."
mkdir ${HOME} && chown ${USER}:${GROUP} ${HOME}
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
# Create pid directory
mkdir /var/run/spamd && chown ${USER}:${GROUP} /var/run/spamd
exit 0