949d2b3d72
- Use USERS PR: ports/158530 Submitted by: Takefu <takefu@airport.fm>
66 lines
2.1 KiB
Bash
66 lines
2.1 KiB
Bash
#!/bin/sh
|
|
PKG_PREFIX=${PKG_PREFIX:-/usr/local}
|
|
USER=${USER:-spamd}
|
|
GROUP=${GROUP:-spamd}
|
|
HOME=/var/spool/${USER}
|
|
|
|
if [ "$2" = "POST-INSTALL" ];then
|
|
ask() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
|
|
read -t120 -p "${question} [${default}]? " answer
|
|
fi
|
|
echo ${answer:-${default}}
|
|
}
|
|
|
|
yesno() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
while :; do
|
|
answer=$(ask "${question}" "${default}")
|
|
case "${answer}" in
|
|
[Yy]*) return 0;;
|
|
[Nn]*) return 1;;
|
|
esac
|
|
echo "Please answer yes or no."
|
|
done
|
|
}
|
|
|
|
# Create pid directory
|
|
install -d -o ${USER} -g ${GROUP} /var/run/spamd
|
|
/usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
|
|
|
|
if [ ${?} -eq 9 ];then
|
|
echo "***********************************************"
|
|
echo "*__ ___ ____ _ _ ___ _ _ ____ *"
|
|
echo "*\ \ / / \ | _ \| \ | |_ _| \ | |/ ___|*"
|
|
echo "* \ \ /\ / / _ \ | |_) | \| || || \| | | _ *"
|
|
echo "* \ V V / ___ \| _ <| |\ || || |\ | |_| |*"
|
|
echo "* \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____|*"
|
|
echo "* *"
|
|
echo "*You must install rules before starting spamd!*"
|
|
echo "***********************************************"
|
|
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
|
|
if yesno "Do you wish to run sa-update to fetch new rules" "N";then
|
|
${PKG_PREFIX}/bin/sa-update || true
|
|
else
|
|
echo ""
|
|
fi
|
|
/usr/bin/su root -c "${PKG_PREFIX}/bin/spamassassin -x -L --lint"
|
|
if [ ${?} -eq 0 ] && grep '^load.*Rule2XSBody' ${PKG_PREFIX}/etc/mail/spamassassin/v320.pre > /dev/null ;then
|
|
if yesno "Do you wish to compile rules with re2c (will take a long time)" "N";then
|
|
${PKG_PREFIX}/bin/sa-compile || true
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|
|
fi # post-install
|
|
|
|
exit 0
|