mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-26 00:55:14 +00:00
49 lines
900 B
Bash
49 lines
900 B
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%%
|
|
|
|
CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
|
|
CYRUS_GROUP=${CYRUS_GROUP:=%%CYRUS_GROUP%%}
|
|
|
|
# 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_USER} 2>/dev/null 1>&2; then
|
|
echo "To delete Cyrus user permanently, use 'pw userdel ${CYRUS_USER}'"
|
|
fi
|
|
if pw groupshow ${CYRUS_GROUP} 2>/dev/null 1>&2; then
|
|
echo "To delete Cyrus group permanently, use 'pw groupdel ${CYRUS_GROUP}'"
|
|
fi
|
|
|
|
}
|
|
|
|
case $2 in
|
|
DEINSTALL)
|
|
delete_sasldb
|
|
;;
|
|
POST-DEINSTALL)
|
|
delete_user
|
|
;;
|
|
|
|
esac
|