5
. /usr/share/debconf/confmodule
9
# Don't fail here, the package might not be configured yet
10
db_get sympa/use_wwsympa || true
13
# Check whether the syslog configuration file is present
14
# in case another system log daemon is used instead of syslog
15
if [ -x /usr/sbin/syslog-facility ]; then
16
if [ -e /etc/syslog.conf ]; then
17
if [ -f /etc/sympa/facility ]; then
18
syslog-facility remove "`cat /etc/sympa/facility`"
20
if [ -x /etc/init.d/sysklogd ]; then
21
/etc/init.d/sysklogd reload
23
rm -f /etc/sympa/facility
28
if [ "$use_wwsympa" = "true" ]; then
29
## Remove Web server configuration
30
db_get wwsympa/webserver_type
38
webserver="apache-ssl"
45
if [ $webserver != "none" ]; then
46
# Check wether the configuration has been modifiyed
47
db_get wwsympa/webserver_modifconf
50
if [ "$modifconf" = "true" ]; then
51
# Remove configuration from httpd.conf
52
if [ -f /etc/$webserver/httpd.conf ]; then
53
sed -e '/#-- WWSYMPA begin/,/#-- WWSYMPA end/d' \
54
/etc/$webserver/httpd.conf > /etc/$webserver/httpd.conf.new
55
mv -f /etc/$webserver/httpd.conf.new /etc/$webserver/httpd.conf
58
# Restarting web server if it was requested at configuration time.
59
db_get wwsympa/webserver_restart
62
if [ "$restart" = "true" ]; then
63
/etc/init.d/$webserver restart
74
db_get sympa/use_wwsympa
77
if [ "$use_wwsympa" = "true" ]; then
78
db_get wwsympa/remove_spool
79
remove_archives="$RET"
81
if [ "$remove_archives" = "true" ]; then
83
echo "Removing archives and spool subdirectories as requested ..."
84
rm -rf /var/lib/sympa/wwsarchive 2>/dev/null || true
85
rm -rf /var/spool/sympa/wws* 2>/dev/null || true
89
# Delete the log files if purging
91
rm -f /var/log/sympa.log*
93
if [ -f /etc/aliases ]; then
94
sed -e '/#-- SYMPA begin/,/#-- SYMPA end/d' \
95
/etc/aliases >/etc/aliases.new
96
mv -f /etc/aliases.new /etc/aliases
100
rm -f /etc/sympa/cookie 2>/dev/null || true
101
rm -f /etc/sympa/cookies.history
103
# Remove configuration files
104
rm -f /etc/sympa/sympa.conf
105
rm -f /etc/sympa/wwsympa.conf
107
# Try to remove if empty
108
rmdir /etc/sympa 2>/dev/null || true
110
db_get sympa/remove_spool
113
if [ "$remove_spool" = "true" ]; then
115
echo "Removing lists data and spool directory as requested ..."
116
rm -rf /var/lib/sympa 2>/dev/null || true
117
rm -rf /var/spool/sympa 2>/dev/null || true
120
# Remove the database if asked for
124
if [ "$use_db" = "true" ]; then
126
# Check whether it was configured
127
db_get sympa/db_configured
130
db_get sympa/db_removeonpurge
131
db_removeonpurge="$RET"
133
if [ "$db_configured" = "true" -a "$db_removeonpurge" = "true" ]
135
# Get the database info
139
db_get sympa/db_hostname
145
db_fset sympa/db_adminpasswd seen false
146
db_input critical sympa/db_adminpasswd || true
149
db_get sympa/db_adminpasswd
151
db_reset sympa/db_adminpasswd
157
echo -n "Trying to remove your PostgreSQL database ..."
161
my \$dsn = \"DBI:Pg:dbname=template1\";
163
if ($db_host ne 'localhost') {
164
\$dsn .= \";host=$db_host\";
167
# Connect to PostgreSQL
168
my \$dbh = DBI->connect(\$dsn, \"postgres\", \"$adminpass\",
169
{\"RaiseError\" => 1});
172
eval {\$dbh->do(\"DROP DATABASE $db_name\")};
175
\$dbh->do(\"DELETE FROM pg_shadow WHERE usename='sympa'\");
177
\$dbh->disconnect();" >/dev/null 2>&1
181
echo -n "Trying to remove your MySQL database ..."
185
my \$dsn = \"DBI:mysql:database=mysql\";
187
if ($db_host ne 'localhost') {
188
\$dsn .= \";host=$db_host\";
192
my \$dbh = DBI->connect(\$dsn, \"root\", \"$adminpass\",
193
{\"RaiseError\" => 1});
195
# Remove the database
196
eval {\$dbh->do(\"DROP DATABASE $db_name\")};
199
\$dbh->do(\"DELETE FROM user WHERE user='sympa'\");
200
\$dbh->do(\"DELETE FROM db WHERE user='sympa'\");
201
\$dbh->do(\"FLUSH PRIVILEGES\");
203
\$dbh->disconnect();" >/dev/null 2>&1
207
if [ "$?" != "0" ]; then
208
/bin/echo -e "Failed\n\n"
209
echo "I was not able to connect to the database server."
210
echo "You will have to remove the sympa database yourself."
213
db_set "sympa/db_configured" "false"