freebsd-ports/mail/mailman/pkg-deinstall
Johann Visagie 2957ac7315 - Update to version 2.0.12
- Update $PKGDEINSTALL so that running Python processes beloning to mailman
  user should be killed correctly upon port/package deinstallation, even when
  the version of Python had been updated since the port/package was
  installed.
- Fix a small oversight in $PLIST to allow clean package installations (i.e.
  where there is not an existing mailman user) to set file permissions
  correctly.
2002-07-22 14:29:09 +00:00

49 lines
1.1 KiB
Bash

#! /bin/sh
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
case $2 in
DEINSTALL)
zero_crontab %%USER%%
if ps -axwU %%USER%% | grep -q python; then
echo 'Killing all running processes belonging to user "%%USER%%".'
killall -m -u %%USER%% python
sleep 2
fi
;;
POST-DEINSTALL)
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%%".'
else
delete_account %%USER%% %%GROUP%%
fi
;;
esac