root/alternc/tags/0.9.8/debian/postrm

Revision 2117, 2.0 kB (checked in by anarcat, 8 months ago)

Major redesign of the MySQL backend interface to fix a security issue.
See: #318.

As of now, the MySQL configuration used everywhere by AlternC is not
stored in the main configuration file (/etc/alternc/local.sh) but in a
MySQL configuration file in /etc/alternc/my.cnf, which enables us to
call mysql without exposing the password on the commandline.

The changes here are quite invasive but will allow us to factor out
the MySQL configuration better. See #364.

This includes a partial rewrite of the mysql.sh logic, which is now ran
from the postinst script (and not alternc.install) which will allow us
to actually change the MySQL root user properly. See #601.

This commit was tested like this:

  • clean install on etch (working)
  • upgrade from a clean 0.9.7 (working)
Line 
1 #! /bin/sh
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.cnf /etc/alternc/bureau.conf
19     rm -f /var/backups/alternc/etc-installed.tar.gz
20
21     # Purge database?
22     db_input high alternc/postrm_remove_databases || true
23     db_go
24     db_get alternc/postrm_remove_databases || true
25     if [ "$RET" = "true" ]; then
26       rm -rf /var/alternc/db
27     fi
28
29     # Purge datafiles?
30     db_input high alternc/postrm_remove_datafiles || true
31     db_go
32     db_get alternc/postrm_remove_datafiles || true
33     if [ "$RET" = "true" ]; then
34       rm -rf /var/backups/alternc /var/alternc/dns /var/alternc/html /var/alternc/redir
35     fi
36
37     # Purge bind zones
38     db_input high alternc/postrm_remove_bind || true
39     db_go
40     db_get alternc/postrm_remove_bind || true
41     if [ "$RET" = "true" ]; then
42       rm -rf /var/alternc/bind /etc/bind/templates
43     fi
44
45     # Purge mailboxes
46     db_input high alternc/postrm_remove_mailboxes || true
47     db_go
48     db_get alternc/postrm_remove_mailboxes || true
49     if [ "$RET" = "true" ]; then
50       rm -rf /var/alternc/mail
51     fi
52
53     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
54     rm -f /etc/apache/conf.d/override_php.conf /etc/apache/conf.d/alternc-ssl.conf /etc/apache/conf.d/alternc.conf
55     ;;
56   remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
57     ;;
58   disappear)
59     ;;
60   *)
61     echo "postrm called with unknown argument \`$1'" >&2
62     exit 1
63     ;;
64 esac
65
66 # dh_installdeb will replace this with shell code automatically
67 # generated by other debhelper scripts.
68
69 #DEBHELPER#
70
71 exit 0
72
73 # vim: et sw=4
Note: See TracBrowser for help on using the browser.