a2d84b3811
- Improve pkg-install script (create /var/dovecot tree) - Add pkg-deinstall to cleanup dovecot directories and remove created uids at de-install; ask to stop dovecot if it's still running - Make pkg-message obey PREFIX/DOCSDIR - Make use of USE_OPENLDAP, rename WITH_LDAP2 to more standard WITH_LDAP - Remove 'Feature Autodetection'. If you want the port built with extra dependencies, tell it: avoid bloat - Update the rc.d script to work with relative addressing (e.g. './dovecot.sh start' works.) - Assign maintainership to the submitter PR: 59762 Submitted by: Robin Breathe <robin@isometry.net>
55 lines
927 B
Bash
55 lines
927 B
Bash
#! /bin/sh
|
|
|
|
ask() {
|
|
local question default answer
|
|
|
|
question=$1
|
|
default=$2
|
|
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
|
|
read -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
|
|
}
|
|
|
|
delete_account() {
|
|
local u
|
|
|
|
u=$1
|
|
if yesno "Do you want me to remove user \"${u}\"" n; then
|
|
pw userdel -n ${u}
|
|
echo "Done."
|
|
fi
|
|
}
|
|
|
|
case $2 in
|
|
|
|
DEINSTALL)
|
|
if ps -axc | grep -qw dovecot; then
|
|
if yesno "Dovecot is still running. Shall I stop it?" y; then
|
|
killall dovecot
|
|
sleep 2
|
|
else
|
|
echo "OK ... I hope you know what you are doing."
|
|
fi
|
|
fi
|
|
|
|
delete_account dovecot
|
|
delete_account dovecot-auth
|
|
;;
|
|
|
|
esac
|