freebsd-ports/japanese/mailman/files/pkg-deinstall.in
TAKATSU Tomonari ac239c2b83 - mail/mailman [1]
* Add LICENSE section
  * Add CONFLICTS with japanese/mailman
  * Make use of SUB_FILES
  * Make use of PORTDOCS
  * Apply simple use of OPTIONS
  * Add WITHOUT_NLS knob to make portlint happier
  * Append "MTA = 'Postfix'" to mm_cfg.py.dist.in when defined
    both WITH_POSTFIX and WITH_INTEGRATION at the same time [3]
  * Bump PORTREVISION

- japanese/mailman [2]
  * Switch to Japanized mailman 2.1.14+j7 based on mail/mailman
  * Take maintainership
  * Add CONFLICTS with mail/mailman
  * Update pkg-descr
  * Set PORTEPOCH because 2.1.14.j7 is less than 2.1.14_6

PR:		ports/165404 (based on) [1], ports/165403 [2]
Submitted by:	tota (myself) [1] [2]
Suggested by:	Yoshito Takeuchi [3]
Approved by:	Sunagawa Koji (maintainer) [2]
Dedicated to:	Tokio Kikuchi
2012-03-04 06:00:38 +00:00

52 lines
1.7 KiB
Bash

#! /bin/sh
#
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
DEINSTALL)
echo "---> Starting deinstall script:"
if /usr/bin/crontab -u "%%USER%%" -l | \
/usr/bin/diff - %%MAILMANDIR%%/cron/crontab.in >/dev/null 2>&1 ; then
echo "---> Zeroing crontab for \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" /dev/null
if [ -e /var/cron/allow ]; then
grep -v %%USER%% /var/cron/allow > /var/cron/allow.new
mv /var/cron/allow.new /var/cron/allow
fi
else
echo "---> Crontab for \"%%USER%%\" not removed: please deinstall"
echo "---> manually if you no-longer wish to use Mailman. eg:"
echo "---> /usr/bin/crontab -u "%%USER%%" -r"
fi
echo "---> Preserving the \"last_mailman_version\" file"
/bin/cp -f %%MAILMANDIR%%/data/last_mailman_version /var/tmp/
# If the errorlog is the only existing logfile, delete it. (If Mailman's
# qrunner had not been running, then the process of trying to stop the
# qrunner (above) will cause the errorlog to be written to. Hence, even if
# the Mailman port/package is installed and immediately deinstalled, the
# errorlog will exist.)
if [ "`echo %%MAILMANDIR%%/logs/*`" = "%%MAILMANDIR%%/logs/error" ]; then
echo "---> Deleting errorlog (It is the only existing logfile.)"
/bin/rm -f %%MAILMANDIR%%/logs/error
fi
;;
POST-DEINSTALL)
echo "---> Starting post-deinstall script:"
if [ -d %%MAILMANDIR%% ]; then
echo '---> %%MAILMANDIR%% is not empty - this installation may have active lists!'
echo "---> Restoring \"last_mailman_version\" file"
[ -d %%MAILMANDIR%%/data ] || /bin/mkdir %%MAILMANDIR%%/data
/bin/mv -f /var/tmp/last_mailman_version %%MAILMANDIR%%/data/
fi
;;
esac