2000-11-01 13:00:13 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# Created by: hetzels@westbend.net
|
|
|
|
|
|
|
|
#set -vx
|
|
|
|
|
|
|
|
PKG_BATCH=${BATCH:=NO}
|
|
|
|
|
|
|
|
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
|
|
|
|
|
2001-12-20 13:18:57 +01:00
|
|
|
SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%%
|
|
|
|
|
2003-01-30 15:04:02 +01:00
|
|
|
CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
|
|
|
|
CYRUS_GROUP=${CYRUS_GROUP:=%%CYRUS_GROUP%%}
|
|
|
|
|
2000-11-01 13:00:13 +01:00
|
|
|
# delete sasldb database
|
|
|
|
|
|
|
|
delete_sasldb() {
|
2002-01-17 16:04:40 +01:00
|
|
|
if [ -f ${SASLDB_NAME} ] ; then
|
2004-03-30 17:28:07 +02:00
|
|
|
if [ `${PKG_PREFIX}/sbin/sasldblistusers2 | wc -l` -eq 0 ]; then
|
2002-01-17 16:04:40 +01:00
|
|
|
rm ${SASLDB_NAME}
|
|
|
|
else
|
|
|
|
echo "WARNING: Users SASL passwords are in ${SASLDB_NAME}, keeping this file"
|
|
|
|
fi
|
|
|
|
fi
|
2000-11-01 13:00:13 +01:00
|
|
|
}
|
|
|
|
|
2002-05-21 17:08:58 +02:00
|
|
|
delete_user() {
|
2003-01-30 15:04:02 +01:00
|
|
|
if pw usershow ${CYRUS_USER} 2>/dev/null 1>&2; then
|
|
|
|
echo "To delete Cyrus user permanently, use 'pw userdel ${CYRUS_USER}'"
|
2002-05-21 17:08:58 +02:00
|
|
|
fi
|
2003-01-30 15:04:02 +01:00
|
|
|
if pw groupshow ${CYRUS_GROUP} 2>/dev/null 1>&2; then
|
|
|
|
echo "To delete Cyrus group permanently, use 'pw groupdel ${CYRUS_GROUP}'"
|
2002-05-24 04:01:13 +02:00
|
|
|
fi
|
2002-05-21 17:08:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-11-01 13:00:13 +01:00
|
|
|
case $2 in
|
|
|
|
DEINSTALL)
|
|
|
|
delete_sasldb
|
|
|
|
;;
|
|
|
|
POST-DEINSTALL)
|
2002-05-21 17:08:58 +02:00
|
|
|
delete_user
|
2000-11-01 13:00:13 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|