pkgsrc/mail/yatsvrs/DEINSTALL
taca 964191578f o Use PKG_SYSCONFSUBDIR.
o Utilize PKG_SYSCONFDIR and nuke own CONFDIR variable.

Suggested by private mail from Johnny Lam <jlam@jgrind.org>.
Thanks jlam!
2001-12-19 04:11:07 +00:00

42 lines
983 B
Bash

#!/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