blob: 0362df163adcfc77c623d6273f1da3afa5e69a96 (
plain) (
blame)
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
43
44
45
46
47
48
49
|
#! /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 -u %%USER%% %%PYTHON_CMD%%
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
|