Alternc  latest
Alternc logiel libre pour l'hébergement
alternc.postrm
Go to the documentation of this file.
1 #! /bin/bash
2 
3 set -e
4 
5 . /usr/share/debconf/confmodule
6 
7 # * postrm remove
8 # * postrm purge
9 # * old-postrm upgrade new-version
10 # * new-postrm failed-upgrade old-version
11 # * new-postrm abort-install
12 # * new-postrm abort-install old-version
13 # * new-postrm abort-upgrade old-version
14 # * disappearer's-postrm disappear overwriter overwriter-version
15 
16 case "$1" in
17  purge)
18  rm -f /etc/alternc/local.sh /etc/alternc/my_mail.cnf /etc/alternc/bureau.conf
19  rm -f /var/lib/alternc/backups/etc-installed.tar.gz
20  rm -f /etc/incron.d/alternc
21 
22  # FIXME : remove following commented lines if we are sure
23  # to not drop database and remove files (except /etc/alternc)
24  # when Alternc is purged
25 
26  # Maybe tell to user how to do if he want to drop db and/or remove files ?
27 
28  # Purge database?
29  #db_input high alternc/postrm_remove_databases || true
30  #db_go
31  #db_get alternc/postrm_remove_databases || true
32  #if [ "$RET" = "true" ]; then
33  # /usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e "DROP DATABASE $ALTERNC_DB"
34  #fi
35 
36  # Purge datafiles
37  #db_input high alternc/postrm_remove_datafiles || true
38  #db_go
39  #db_get alternc/postrm_remove_datafiles || true
40  #if [ "$RET" = "true" ]; then
41  # rm -rf /var/lib/alternc/backups /var/alternc/dns /var/alternc/html /var/alternc/redir
42  #fi
43 
44  # Purge bind zones
45  #db_input high alternc/postrm_remove_bind || true
46  #db_go
47  #db_get alternc/postrm_remove_bind || true
48  #if [ "$RET" = "true" ]; then
49  # rm -rf /var/alternc/bind /etc/bind/templates
50  #fi
51 
52  # Purge mailboxes
53  #db_input high alternc/postrm_remove_mailboxes || true
54  #db_go
55  #db_get alternc/postrm_remove_mailboxes || true
56  #if [ "$RET" = "true" ]; then
57  # rm -rf /var/alternc/mail
58  #fi
59 
60  #rm -rf /var/alternc/apacheconf /var/alternc/cgi-bin /var/alternc/bureau /var/alternc/exec.usr /var/alternc/mla /var/alternc/redir /var/alternc/tmp /var/log/alternc
61  rm -f /etc/apache*/conf.d/override_php.conf /etc/apache*/conf.d/alternc-ssl.conf /etc/apache*/conf.d/alternc.conf
62  rm -f /etc/php*/conf.d/alternc.ini
63 
64  # Restore orignals conf files which have been replaced by Alternc
65  # With the oldest tar found
66  BACKUP=$(ls /var/lib/alternc/backups/etc-original*.tar.gz | head -n 1)
67  tar -C / -xf "$BACKUP" 2>/dev/null || true
68 
69  # Reload services which use these files
70  for service in bind9 postfix proftpd dovecot apache2; do
71  invoke-rc.d $service force-reload || true
72  done
73 
74  ;;
75  remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
76  ;;
77  disappear)
78  ;;
79  *)
80  echo "postrm called with unknown argument \`$1'" >&2
81  exit 1
82  ;;
83 esac
84 
85 # dh_installdeb will replace this with shell code automatically
86 # generated by other debhelper scripts.
87 
88 #DEBHELPER#
89 
90 # important: postrm freezes withtout that:
91 db_stop
92 
93 exit 0
94 
95 # vim: et sw=4