diff options
author | Johann Visagie <wjv@FreeBSD.org> | 2003-01-23 12:49:00 +0000 |
---|---|---|
committer | Johann Visagie <wjv@FreeBSD.org> | 2003-01-23 12:49:00 +0000 |
commit | 9fb9d105a9c0255450b8a3a4ecf4b6d455380260 (patch) | |
tree | 437c0e6fc72787701719011aa7baecaf4222cbf3 /mail/mailman/pkg-deinstall | |
parent | 451c213b4b84f1dcd51cbe828152b80a486535f3 (diff) |
Notes
Diffstat (limited to 'mail/mailman/pkg-deinstall')
-rw-r--r-- | mail/mailman/pkg-deinstall | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/mail/mailman/pkg-deinstall b/mail/mailman/pkg-deinstall index 156f0ed01359..180ac640fa0d 100644 --- a/mail/mailman/pkg-deinstall +++ b/mail/mailman/pkg-deinstall @@ -2,50 +2,53 @@ # # $FreeBSD$ -delete_account() { - local u g home - - u=$1 - g=$2 - echo -n "Removing group \"${g}\"... " - pw groupdel -n ${g} - echo "done." - echo -n "Removing user \"${u}\"... " - eval home=~${u} - echo 'y' | pw userdel -n ${u} - echo "done." -} - -zero_crontab() { - local u - - u=$1 - - echo -n 'Zeroing crontab(5) file belonging to user "%%USER%%"... ' - crontab -u ${u} /dev/null || exit - echo 'done.' - echo '(The crontab(5) will be deleted completely when user "%%USER%%" is removed.)' -} - -export PATH=/bin:/usr/bin:/usr/sbin +PATH=/bin:/usr/bin:/usr/sbin case $2 in + DEINSTALL) - zero_crontab %%USER%% - if ps -axwU %%USER%% | grep -q python; then - echo "Stopping Mailman's qrunner daemon." - %%PREFIX%%/etc/rc.d/mailman.sh stop >/dev/null 2>&1 - sleep 2 + echo "---> Starting deinstall script:" + + echo "---> Zeroing crontab(5) file belonging to user \"%%USER%%\"" + /usr/bin/crontab -u %%USER%% /dev/null + echo " (The crontab(5) will be deleted completely when user %%USER%% is removed.)" + + echo "---> Stopping Mailman's qrunner daemon" + %%PREFIX%%/etc/rc.d/mailman.sh stop >/dev/null 2>&1 + /bin/sleep 2 + + 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 '- The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.' - echo '- You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".' + echo '---> %%MAILMANDIR%% is not empty - this installation may have active lists!' + echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.' + echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".' + + echo "---> Restoring \"last_mailman_version\" file" + [ -d %%MAILMANDIR%%/data ] || /bin/mkdir %%MAILMANDIR%%/data + /bin/mv -f /var/tmp/last_mailman_version %%MAILMANDIR%%/data/ + else - delete_account %%USER%% %%GROUP%% + echo "---> Removing group \"%%GROUP%%\"" + /usr/sbin/pw groupdel -n %%GROUP%% + echo "---> Removing user \"%%USER%%\"" + echo 'y' | /usr/sbin/pw userdel -n %%USER%% fi ;; + esac |