aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/ifgraph/pkg-deinstall
blob: 5724a05f20ff176a8b6d8c606c10b697b702e47b (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
#!/bin/sh
#
# $FreeBSD$
#

PATH=/bin:/usr/bin:/usr/sbin

case $2 in

DEINSTALL)
  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.)'

  ;;

POST-DEINSTALL)
  echo '---> Starting post-deinstall script:'

  if [ -f %%PREFIX%%/etc/ifgraph.conf -o \
       -d %%PREFIX%%/ifgraph -o \
       -d %%PREFIX%%/var/ifgraph ]; then
    echo '---> You seem to have made some custom ifGraph configuration.'
    echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.'
    echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".'

  else
    echo '---> Removing group "%%GROUP%%"'
    /usr/sbin/pw groupdel -n %%GROUP%%
    echo '---> Removing user "%%USER%%"'
    echo 'y' | /usr/sbin/pw userdel -n %%USER%%
  fi

  ;;

esac