summaryrefslogtreecommitdiff
path: root/mail/yatsvrs/DEINSTALL
blob: 2ca814e90420032384308baa21556e9d69e14a39 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# $Id: DEINSTALL,v 1.2 2001/12/19 04:11:07 taca Exp $

AWK="@AWK@"
CAT="@CAT@"
CMP="@CMP@"
RM="@RM@"
RMDIR="@RMDIR@"

YAT_CONF_DIR="@PKG_SYSCONFDIR@"
YAT_EXAMPLES_DIR="@EXAMPLESDIR@"
EXAMPLES="@EXAMPLES@"
MIN="@YATSVR_MINGID@"
MAX="@YATSVR_MAXGID@"

case "$2" in
DEINSTALL)

	for f in ${EXAMPLES}; do
		if ${CMP} -s ${YAT_CONF_DIR}/$f ${YAT_EXAMPLES_DIR}/$f.example; then
			${RM} ${YAT_CONF_DIR}/$f
		fi
	done
	admin=`${CAT} ${YAT_CONF_DIR}/.admin`
	if [ x$admin = x'root' ]; then
		${RM} ${YAT_CONF_DIR}/.admin
	fi
	${AWK} -F: '$1 !~ /^no/ { if ($3 < '$MIN' || $3 > '$MAX') print $1}' \
		/etc/group > /tmp/hidden-group
	if ${CMP} -s ${YAT_CONF_DIR}/.hidden-group /tmp/hidden-group; then
		${RM} ${YAT_CONF_DIR}/.hidden-group
	fi
	${RM} -f /tmp/hidden-group
	${RM} -f ${YAT_CONF_DIR}/*\~old
	${RMDIR} ${YAT_CONF_DIR} >/dev/null 2>&1
	if [ -d ${YAT_CONF_DIR} ]; then
		${CAT} <<EOF
If you would never want to use yatsvrs any more, remove ${YAT_CONF_DIR}.
EOF
	fi
	;;
esac