58 lines
1.2 KiB
Bash
58 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# Created by: hetzels@westbend.net
|
|
|
|
#set -vx
|
|
|
|
PKG_BATCH=${BATCH:=NO}
|
|
|
|
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
|
|
|
|
SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%%
|
|
|
|
# delete sasldb database
|
|
|
|
delete_sasldb() {
|
|
if [ -f ${SASLDB_NAME} ] ; then
|
|
if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ] ; then
|
|
rm ${SASLDB_NAME}
|
|
else
|
|
echo "WARNING: Users SASL passwords are in ${SASLDB_NAME}, keeping this file"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
delete_user() {
|
|
if pw usershow cyrus 2>/dev/null 1>&2; then
|
|
echo "To delete Cyrus user permanently, use 'pw userdel cyrus'"
|
|
fi
|
|
if pw groupshow cyrus 2>/dev/null 1>&2; then
|
|
echo "To delete Cyrus group permanently, use 'pw groupdel cyrus'"
|
|
fi
|
|
|
|
}
|
|
|
|
# This should really be uninstalled by Sendmail
|
|
|
|
sendmail_conf() {
|
|
if [ -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf ]; then
|
|
echo "pwcheck_method: %%PWCHECK_METHOD%%" > ${PKG_PREFIX}/lib/sasl2/Sendmail.conf.tmp
|
|
if cmp -s ${PKG_PREFIX}/lib/sasl2/Sendmail.conf ${PKG_PREFIX}/lib/sasl2/Sendmail.conf.tmp; then
|
|
rm -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf
|
|
fi
|
|
rm -f ${PKG_PREFIX}/lib/sasl2/Sendmail.conf.tmp
|
|
fi
|
|
}
|
|
|
|
case $2 in
|
|
DEINSTALL)
|
|
delete_sasldb
|
|
sendmail_conf
|
|
;;
|
|
POST-DEINSTALL)
|
|
delete_user
|
|
;;
|
|
|
|
esac
|