summaryrefslogtreecommitdiff
path: root/security/courier-authlib/files/pkg-deinstall.in
blob: db7da5cfbd9110044dd6105b2d36467b904d99cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#
# $FreeBSD$
#

PKG_PREFIX=${PKG_PREFIX:=/usr/local}
LOCALSTATEDIR=${LOCALSTATEDIR:=/var/spool/courier}

USER=%%MAILOWN%%
GROUP=%%MAILGRP%%

if [ ":$2" = ":POST-DEINSTALL" ]; then
    if [ -z "${PACKAGE_BUILDING}" ]; then
        echo ""
        echo "Warning: Removing user courier will also delete any"
        echo "	 undelivered mail in the mail queue directories!!!"
        echo "	 Do *not* do it if you're upgrading and would like"
        echo "	 courier to continue trying to deliver this mail."
        echo ""
    else
        AFFIRM='-y'
    fi
    [ -d "$LOCALSTATEDIR" ] && /usr/sbin/chown -Rh ${USER}:${GROUP} "$LOCALSTATEDIR"
    /usr/sbin/rmuser ${AFFIRM} ${USER} 2> /dev/null
    [ -d "$LOCALSTATEDIR" ] && /usr/sbin/chown root:wheel "$LOCALSTATEDIR"
fi

exit 0