[Pkg-sympa-commits] [SCM] sympa Debian packaging branch, master, updated. debian/6.1.7_dfsg-1-14-g351ae33
Emmanuel Bouthenot
kolter at openics.org
Sun Dec 4 19:25:38 UTC 2011
The following commit has been merged in the master branch:
commit 562d0b9ae72d1d2673022e050d704c45855aed56
Author: Emmanuel Bouthenot <kolter at openics.org>
Date: Sun Dec 4 18:16:26 2011 +0000
Various code cleanup and fixes in maintainer and debconf scripts (#411987)
diff --git a/debian/config b/debian/config
index 992d6c5..764a529 100644
--- a/debian/config
+++ b/debian/config
@@ -12,59 +12,57 @@ set -e
db_version 2.0
+conf="/etc/sympa/sympa.conf"
+wwconf="/etc/sympa/wwsympa.conf"
+
# Language selection
# - currently supported languages
possible_langs="ca cs de el es et_EE fr hu it ja_JP ko nl oc pt_BR ru sv tr zh_CN zh_TW"
supported_langs="en_US"
-locales=`locale -a`
+locales=$(locale -a)
-for lang in $possible_langs; do
- if locale -a | grep $lang >/dev/null; then
+for lang in $possible_langs ; do
+ if locale -a | grep -q "$lang" ; then
supported_langs="$supported_langs, $lang"
fi
done
# Get the language value in case of a manual change
-conf='/etc/sympa/sympa.conf'
if [ -f "$conf" ]; then
- lang=`perl -nle 'if (/^\s*lang\s+(\w+)/) {print $1;}' $conf`
+ lang=$(perl -nle 'if (/^\s*lang\s+(\w+)/) {print $1;}' "$conf")
db_set sympa/language "$lang"
-
# Get the hostname.
# Since this parameter could be a unix command, we have
# to check this and run the command to get the value
if grep -q "^[ ]*host" "$conf" ; then
- host=`perl -nle 'if (/^\s*host\s+(.*)\$/) {
- if (\$1 =~ m/^\`(.*)\`\$/) {
- \$cmd=\`\$1\`; print \$cmd;
+ host=$(perl -nle 'if (/^\s*host\s+(.*)$/) {
+ if ($1 =~ m/^`(.*)`$/) {
+ $cmd=`$1`; print $cmd;
} else {
- print \$1;
+ print $1;
}
- }' $conf`
+ }' "$conf")
else
- host=`perl -nle 'if (/^\s*domain\s+(.*)\$/) {
- if (\$1 =~ m/^\`(.*)\`\$/) {
- \$cmd=\`\$1\`; print \$cmd;
+ host=$(perl -nle 'if (/^\s*domain\s+(.*)$/) {
+ if ($1 =~ m/^`(.*)`$/) {
+ $cmd=`$1`; print $cmd;
} else {
- print \$1;
+ print $1;
}
- }' $conf`
+ }' "$conf")
fi
-
- # Get the listmasters
- # Since this parameter could be a unix command, we have
+ # Get the listmasters, since this parameter could be a unix command, we have
# to check this and run the command to get the value
- listmaster=`perl -nle 'if (/^\s*listmaster\s+(.*)\$/) {
- if (\$1 =~ m/^\`(.*)\`\$/) {
- \$cmd=\`\$1\`; print \$cmd;
+ listmaster=$(perl -nle 'if (/^\s*listmaster\s+(.*)$/) {
+ if ($1 =~ m/^`(.*)`$/) {
+ $cmd=`$1`; print $cmd;
} else {
- print \$1;
+ print $1;
}
- }' $conf`
+ }' "$conf")
else
# Get default values on configure
- host=`head -n 1 /etc/mailname || hostname -f || echo localhost`
-
+ host=$(head -n 1 /etc/mailname || hostname -f || echo localhost)
listmaster=
fi
@@ -106,7 +104,7 @@ if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
if [ -f "$conf" ] && dbctmpfile=$(tempfile -p sympa); then
# Extract sympa.conf options parsable by dbconfig-common
perl -ne 'print "$1=\"$2\"\n" if /^\s*(db_[a-z]+)\s*(.*)\s*$/' \
- /etc/sympa/sympa.conf > "$dbctmpfile"
+ "$conf" > "$dbctmpfile"
dbc_load_include="sh:$dbctmpfile"
dbc_load_include_args="-d db_name -p db_passwd -s db_host -P db_port -u db_user -t db_type"
fi
@@ -114,21 +112,18 @@ if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
rm -f -- "$dbctmpfile"
fi
-conf='/etc/sympa/wwsympa.conf'
-
db_get wwsympa/wwsympa_url
if [ -z "$RET" ]; then
wwsympa_url_default="http://${host}/wws"
# Get the url from sympa.conf
if [ -f "$conf" ]; then
- wwsympa_url_conf=`perl -nle 'if (/^\s*wwsympa_url\s+(.*)$/) {print $1;}' $conf`
+ wwsympa_url_conf=$(perl -nle 'if (/^\s*wwsympa_url\s+(.*)$/) {print $1;}' "$conf")
if [ -z "$wwsympa_url" ]; then
db_get wwsympa/wwsympa_url
wwsympa_url_conf="$RET"
fi
fi
-
if [ -z "$wwsympa_url_conf" ]; then
db_set wwsympa/wwsympa_url "$wwsympa_url_default"
else
@@ -140,14 +135,14 @@ db_input medium wwsympa/wwsympa_url || [ $? -eq 30 ]
db_go
db_get wwsympa/fastcgi
-if [ -z "$RET" -a -f /etc/sympa/wwsympa.conf ]; then
- fastcgi=`perl -nle 'if (/^\s*use_fast_cgi\s+(\d)$/) {print $1;}' $conf`
- case $fastcgi in
- "1")
- fastcgi="true"
- ;;
+if [ -z "$RET" ] && [ -f "$wwconf" ]; then
+ fastcgi=$(perl -nle 'if (/^\s*use_fast_cgi\s+(\d)$/) {print $1;}' "$wwconf")
+ case "$fastcgi" in
+ 1)
+ fastcgi="true"
+ ;;
*)
- fastcgi="false"
+ fastcgi="false"
;;
esac
db_set wwsympa/fastcgi "$fastcgi"
@@ -167,7 +162,6 @@ if [ "$webserver" != "none" ]; then
# Ask for soap usage
db_input medium sympa/use_soap || [ $? -eq 30 ]
db_go
-
db_input high wwsympa/webserver_restart || [ $? -eq 30 ]
db_go
fi
diff --git a/debian/postrm b/debian/postrm
deleted file mode 100644
index c66d5ad..0000000
--- a/debian/postrm
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ -f /usr/share/debconf/confmodule ]; then
- . /usr/share/debconf/confmodule
-fi
-if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
- . /usr/share/dbconfig-common/dpkg/postrm
- dbc_go sympa $@
-fi
-
-case "$1" in
- "remove")
-
- if [ -f /usr/share/debconf/confmodule ]; then
- db_get sympa/use_soap || true
- use_soap="$RET"
- else
- use_soap="false"
- fi
-
- # Check whether the syslog configuration file is present
- # in case another system log daemon is used instead of syslog
- if [ -f /etc/sympa/facility ]; then
- if perl -ne '/(\S+)/ || exit 1; $ENV{facility}=$1; exit' /etc/sympa/facility \
- && which syslog-facility >/dev/null 2>&1 \
- && [ -e /etc/syslog.conf ] \
- && syslog-facility remove "$facility" \
- && [ -x /etc/init.d/sysklogd ]; then
- if which invoke-rc.d >/dev/null 2>&1; then
- invoke-rc.d sysklogd reload
- else
- etc/init.d/sysklogd reload
- fi
- fi
- rm -f /etc/sympa/facility
- fi
-
- if [ "$use_soap" = "true" ]; then
- ## Remove Web server configuration
- db_get wwsympa/webserver_type
- webserver="$RET"
-
- case $webserver in
- "Apache 2")
- webserver="apache2"
- ;;
- *)
- webserver="none"
- ;;
- esac
-
- if [ "$use_soap" = "true" ]; then
- # Remove symbolic link to webserver configuration snippet
- link=`readlink /etc/$webserver/conf.d/sympa-soap || true`
- if [ "$link" = "/etc/sympa/apache-soap" ]; then
- rm -f /etc/$webserver/conf.d/sympa-soap
- fi
- fi
-
- if [ $webserver != "none" ]; then
- # Restarting web server if it was requested at configuration time.
- db_get wwsympa/webserver_restart
- restart="$RET"
-
- if [ "$restart" = "true" ]; then
- if [ -x /etc/init.d/$webserver ]; then
- if which invoke-rc.d >/dev/null 2>&1; then
- invoke-rc.d $webserver force-reload
- else
- etc/init.d/$webserver force-reload
- fi
- fi
-
- # End up with debconf
- db_stop
- fi
- fi
- fi
- ;;
-
- "purge")
- db_input high wwsympa/remove_spool || true
- db_go
- db_get wwsympa/remove_spool
- remove_archives="$RET"
-
- if [ "$remove_archives" = "true" ]; then
- echo ""
- echo "Removing archives and spool subdirectories as requested ..."
- rm -rf /var/lib/sympa/wwsarchive 2>/dev/null || true
- rm -rf /var/spool/sympa/wws* 2>/dev/null || true
- fi
-
- # Delete the log files if purging
- # Remove aliases too.
- rm -f /var/log/sympa.log*
-
- # Remove static content directory
- if [ -d /var/lib/sympa/static_content ]; then
- rm -r /var/lib/sympa/static_content
- fi
-
- if [ -f /etc/aliases ]; then
- sed -i~ -e '/#-- SYMPA begin/,/#-- SYMPA end/d' /etc/aliases
- rm -f /etc/aliases~
- newaliases || true
- fi
-
- rm -f /etc/sympa/cookie 2>/dev/null || true
- rm -f /etc/sympa/cookies.history
-
- # Remove configuration files
- rm -f /etc/sympa/data_structure.version
- rm -f /etc/sympa/sympa.conf
- rm -f /etc/sympa/wwsympa.conf
-
- # Try to remove if empty
- rmdir /etc/sympa 2>/dev/null || true
-
- if [ -f /usr/share/debconf/confmodule ]; then
- db_input high sympa/remove_spool || true
- db_go
- db_get sympa/remove_spool
- remove_spool="$RET"
-
- if [ "$remove_spool" = "true" ]; then
- echo ""
- echo "Removing lists data and spool directory as requested ..."
- rm -rf /var/lib/sympa 2>/dev/null || true
- rm -rf /var/spool/sympa 2>/dev/null || true
- fi
- fi
- ;;
-esac
-
-#DEBHELPER#
diff --git a/debian/postinst b/debian/sympa.postinst
similarity index 70%
rename from debian/postinst
rename to debian/sympa.postinst
index 50acc83..d2a1b4f 100644
--- a/debian/postinst
+++ b/debian/sympa.postinst
@@ -4,42 +4,35 @@ set -e
# Source debconf library
. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst
conf=/etc/sympa/sympa.conf
wwconf=/etc/sympa/wwsympa.conf
# creating sympa user if he isn't already there
-if ! id sympa >/dev/null 2>/dev/null ; then
+if ! getent passwd sympa >/dev/null ; then
echo "Adding system user: sympa."
adduser --system --group --gecos "Sympa mailing list manager" --no-create-home --home /var/lib/sympa sympa >/dev/null
fi
-# Stop the daemon if it has already been started
-# This is necessary when you run dpkg-reconfigure
+# Stop the daemon if it has already been started This is necessary when you run
+# dpkg-reconfigure
if [ "$1" = "configure" ]; then
- if [ -f /var/run/sympa/sympa.pid ]; then
+ if [ -f /etc/init.d/sympa ]; then
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d sympa stop || true
else
- etc/init.d/sympa stop || true
+ /etc/init.d/sympa stop || true
fi
fi
fi
-# Ensure that directory exists
-if [ ! -d /etc/sympa ]; then
- mkdir /etc/sympa
-fi
-
-# Ensure that data structure version file exists
-# and is writable for Sympa
-if [ ! -f /etc/sympa/data_structure.version ]; then
- if [ "$1" = "configure" ]; then
- if [ -n "$2" ] && dpkg --compare-versions "$2" lt "5.2.3"; then
- echo "$2" > /etc/sympa/data_structure.version
- else
- touch /etc/sympa/data_structure.version
- fi
+# Ensure that data structure version file exists and is writable for Sympa
+if [ ! -f /etc/sympa/data_structure.version ] && [ "$1" = "configure" ]; then
+ if [ -n "$2" ] && dpkg --compare-versions "$2" lt "5.2.3"; then
+ echo "$2" > /etc/sympa/data_structure.version
+ else
+ touch /etc/sympa/data_structure.version
fi
fi
chown sympa:sympa /etc/sympa/data_structure.version
@@ -47,30 +40,24 @@ chown sympa:sympa /etc/sympa/data_structure.version
# Install sympa.conf
if [ -f "$conf" ]; then
# Replace/disable obsolete settings in configuration file
- perl -i~ -pe 's%^\s*msgcat(.*)%localedir /usr/lib/sympa/locale%; s%(\s*queueexpire.*)%# $1%;' "$conf"
- rm -f "$conf"~
-fi
-
-if [ ! -f "$conf" ]; then
+ perl -i -pe 's%^\s*msgcat(.*)%localedir /usr/lib/sympa/locale%; s%(\s*queueexpire.*)%# $1%;' "$conf"
+else
+ # Create congfiguration file
/usr/lib/sympa/bin/sympa_wizard.pl --create sympa.conf --target "$conf"
- perl -i~ -pe 's%^#?(cookie\s+).*%cookie `cat /etc/sympa/cookie`%; s%^(syslog\s+).*%syslog `cat /etc/sympa/facility`%;' "$conf"
- rm -f "$conf"~
+ perl -i -pe 's%^#?(cookie\s+).*%cookie `cat /etc/sympa/cookie`%; s%^(syslog\s+).*%syslog `cat /etc/sympa/facility`%;' "$conf"
fi
-# Install wwsympa.conf
-# Even if WWSympa is not used, we need to provide a default wwsympa.conf
+# Install wwsympa.conf even if WWSympa is not used, we need to provide a
+# default wwsympa.conf
if [ ! -f "$wwconf" ]; then
/usr/lib/sympa/bin/sympa_wizard.pl --create wwsympa.conf --target "$wwconf"
- perl -i~ -pe 's%^(arc_path\s+).*%$1/var/lib/sympa/wwsarchive%; s%^(bounce_path\s+).*%$1/var/spool/sympa/wwsbounce%' "$wwconf"
- rm -f "$wwconf"~
+ perl -i -pe 's%^(arc_path\s+).*%$1/var/lib/sympa/wwsarchive%; s%^(bounce_path\s+).*%$1/var/spool/sympa/wwsbounce%' "$wwconf"
fi
# Configure the language
db_get sympa/language
lang="$RET"
-
-perl -pi~ -e "s/^\s*lang.*$/lang\t\t$lang/;" "$conf"
-rm -f "$conf"~
+perl -pi -e "s/^\s*lang.*$/lang\t\t$lang/;" "$conf"
# Fixing supported_lang if empty
perl -i -pe "s/^\s*(supported_lang)\s*\$/\$1\t\tnone\n/;" "$conf"
@@ -78,54 +65,46 @@ perl -i -pe "s/^\s*(supported_lang)\s*\$/\$1\t\tnone\n/;" "$conf"
# Get the hostname
db_get sympa/hostname
hostn="$RET"
-if grep -q "^[ ]*host" "$conf" ; then
- perl -pi~ -e "s/^\s*host.*$/domain\t\t$hostn/;" "$conf"
+if grep -q "^[[:space:]]*host" "$conf" ; then
+ perl -pi -e "s/^\s*host.*$/domain\t\t$hostn/;" "$conf"
else
- perl -pi~ -e "s/^\s*domain.*$/domain\t\t$hostn/;" "$conf"
+ perl -pi -e "s/^\s*domain.*$/domain\t\t$hostn/;" "$conf"
fi
-rm -f "$conf"~
# Get the listmasters and escape '@' caracters for Perl processing. Ugly, anyway ...
db_get sympa/listmaster
-listmaster=`echo $RET | sed 's/@/\\\\@/g'`
-perl -pi~ -e "s/^\s*listmaster.*$/listmaster\t\t$listmaster/;" "$conf"
-rm -f "$conf"~
+listmaster=$(echo $RET | sed 's/@/\\@/g')
+perl -pi -e "s/^\s*listmaster.*$/listmaster\t\t$listmaster/;" "$conf"
-if [ "$1" = "configure" ]; then
- if [ -n "$2" ] && dpkg --compare-versions "$2" lt "6.0.1"; then
- # add required parameters in Sympa 6
- if grep -q bounce_warn_rate $conf; then
- echo "bounce_warn_rate 30" >> $conf;
- fi
- if grep -q bounce_halt_rate $conf; then
- echo "bounce_halt_rate 50" >> $conf;
- fi
- # fix paths
- perl -pi~ -e "s%^home\s+/usr/lib/sympa/expl$%home /var/lib/sympa/expl%; s%^static_content_path\s+/usr/lib/sympa/static_content%static_content_path /var/lib/sympa/static_content%;" "$conf"
- rm -f "$conf"~
+if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions "$2" lt "6.0.1"; then
+ # add required parameters in Sympa 6
+ if grep -q bounce_warn_rate $conf; then
+ echo "bounce_warn_rate 30" >> $conf;
fi
+ if grep -q bounce_halt_rate $conf; then
+ echo "bounce_halt_rate 50" >> $conf;
+ fi
+ # fix paths
+ perl -pi -e "s%^home\s+/usr/lib/sympa/expl$%home /var/lib/sympa/expl%; s%^static_content_path\s+/usr/lib/sympa/static_content%static_content_path /var/lib/sympa/static_content%;" "$conf"
fi
## ensure permissions and ownerships are right
if [ -e /var/log/sympa.log ] && [ ! -f /var/log/sympa.log ]; then
echo "Problem: /var/log/sympa.log already exists and it isn't a file !"
fi
+touch /var/log/sympa.log || true
+chown sympa:sympa /var/log/sympa.log
+chmod 0640 /var/log/sympa.log
-## Upgrade workaround problem in case of the old list home
-## directory does not contain any list configuration and was
-## removed on upgrade.
+# Upgrade workaround problem in case of the old list home directory does not
+# contain any list configuration and was removed on upgrade.
if [ ! -d /var/spool/sympa/expl ]; then
- sed -i~ -e "s;\([^#]*\)/var/spool/sympa/expl;\1/var/lib/sympa/expl;" "$conf"
- rm -f "$conf"~
+ sed -i -e "s;\([^#]*\)/var/spool/sympa/expl;\1/var/lib/sympa/expl;" "$conf"
fi
chown -R sympa:sympa /etc/sympa/*
chmod 0640 "$conf" /etc/sympa/sympa.conf-smime.in
-touch /var/log/sympa.log || true
-chown sympa:sympa /var/log/sympa.log
-chmod 0640 /var/log/sympa.log
-
# Get rid of the old /etc/sympa/config directory
if [ -d /etc/sympa/config ]; then
rm -f /etc/sympa/config/helpfile
@@ -134,7 +113,7 @@ if [ -d /etc/sympa/config ]; then
rmdir /etc/sympa/config || true
fi
-## Add the sympa aliases
+# Add the sympa aliases
if ! grep -q "#-- SYMPA begin" /etc/aliases
then
cat >>/etc/aliases <<EOF
@@ -166,12 +145,12 @@ if [ -d /etc/mail/sympa ]; then
done
fi
-## Create file for mailing list aliases
+# Create file for mailing list aliases
if [ ! -f /etc/mail/sympa/aliases ]; then
echo "## List aliases used for the sympa mailing-list manager" > /etc/mail/sympa/aliases
fi
-## Ensure permissions are correct
+# Ensure permissions are correct
for ext in '' '.db' ; do
if [ -f /etc/mail/sympa/aliases${ext} ]; then
chown sympa:sympa /etc/mail/sympa/aliases${ext}
@@ -191,7 +170,9 @@ if which syslog-facility >/dev/null 2>&1 \
fi
fi
## ...and ensure existence and access rights of facility file even if unused
-[ -e /etc/sympa/facility ] || touch /etc/sympa/facility
+if [ ! -e /etc/sympa/facility ]; then
+ touch /etc/sympa/facility
+fi
chown sympa:sympa /etc/sympa/facility
## Create a unique cookie for this host
@@ -228,8 +209,6 @@ if [ -d /etc/mail/smrsh ]; then
ln -sf /usr/lib/sympa/bin/queue /etc/mail/smrsh
fi
-. /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst
dbc_first_version="5.3.4-6~"
dbc_dbfile_owner="sympa:sympa"
dbc_go sympa $@
@@ -243,23 +222,28 @@ installed_dbd() {
return 1
}
-# Translate database parameters from dbconfig-common to Sympa's db_xxx configuration values
+# Translate database parameters from dbconfig-common to Sympa's db_xxx
+# configuration values
name=$dbc_dbname
-case "$dbc_dbtype" in
- mysql)
- type=mysql;;
- pgsql)
- type=Pg;;
- sqlite*)
- type=SQLite;
- name="$dbc_basepath/$dbc_dbname";;
- *)
- echo "Unknown database type $dbc_dbtype.";
- exit 1;;
+case "$dbc_dbtype" in
+ mysql)
+ type=mysql
+ ;;
+ pgsql)
+ type=Pg
+ ;;
+ sqlite*)
+ type=SQLite
+ name="$dbc_basepath/$dbc_dbname"
+ ;;
+ *)
+ echo "Unknown database type $dbc_dbtype."
+ exit 1
+ ;;
esac
# Install the database configuration
-NEW=`perl -i~ -pe "BEGIN {
+NEW=$(perl -i -pe "BEGIN {
%db= (type => '$type', name => '$name', host => '$dbc_dbserver', user => '$dbc_dbuser', passwd => '$dbc_dbpass', options => '$dbc_dboptions', port => '$dbc_dbport');}; "'
END {
for (keys %db) {
@@ -279,19 +263,16 @@ if (exists $db{$2}) {
}
} else {
"$1$2$3$4";
-}%e;' "$conf"`
-rm -f "$conf"~
+}%e;' "$conf")
if [ -n "$NEW" ]; then
echo "$NEW" >> "$conf"
fi
-## Upgrade workaround problem in case of the old web archive
-## directory does not contain any archive file and was
-## removed on upgrade.
+# Upgrade workaround problem in case of the old web archive directory does not
+# contain any archive file and was removed on upgrade.
if [ ! -d /var/spool/sympa/wwsarchive ]; then
- sed -i~ -e "s;\([^#]*\)/var/spool/sympa/wwsarchive;\1/var/lib/sympa/wwsarchive;" "$wwconf"
- rm -f "$wwconf"~
+ sed -i -e "s;\([^#]*\)/var/spool/sympa/wwsarchive;\1/var/lib/sympa/wwsarchive;" "$wwconf"
fi
# Ensure permissions and ownerships are right
@@ -347,8 +328,7 @@ fi
# Read FastCGI setting
db_get wwsympa/fastcgi
fastcgi="$RET"
-
-if [ $fastcgi = "true" ]; then
+if [ "$fastcgi" = "true" ]; then
if [ $webserver = "apache2" ]; then
if [ ! -f /etc/apache2/mods-enabled/fcgid.load ] && [ ! -f /etc/apache2/mods-enabled/fastcgi.load ]; then
echo "FastCGI module not installed or enabled, skipping."
@@ -356,36 +336,24 @@ if [ $fastcgi = "true" ]; then
fi
fi
fi
-
-## Generate "$wwconf"
-case $fastcgi in
- "true")
- fastcgi="1"
- ;;
- *)
- fastcgi="0"
- ;;
-esac
+if [ "$fastcgi" = "true" ]; then
+ perl -pi -e 's%^\s*(use_fast_cgi)\s+\d+%$1\t1%' "$wwconf"
+else
+ perl -pi -e 's%^\s*(use_fast_cgi)\s+\d+%$1\t0%' "$wwconf"
+fi
db_get wwsympa/wwsympa_url
wwsympa_url="$RET"
-
perl -i -pe "s%^(wwsympa_url\s+).*%wwsympa_url ${wwsympa_url}%" "$conf"
-if [ "$fastcgi" = "1" ]; then
- db_get sympa/use_soap
- use_soap="$RET"
-
- # Use SOAP
- if [ "$use_soap" = "true" ]; then
- chown sympa:sympa /usr/lib/cgi-bin/sympa/sympa_soap_server.fcgi
- chmod 6755 /usr/lib/cgi-bin/sympa/sympa_soap_server.fcgi
- if ! grep -q soap_url "$conf"; then
- echo "soap_url http://${hostn}/sympasoap" >> "$conf"
- else
- perl -pi~ -e "s%^(soap_url\s+).*%soap_url http://$hostn/sympasoap%" "$conf"
- rm -f "$conf"~
- fi
+db_get sympa/use_soap
+use_soap="$RET"
+# Use SOAP
+if [ "$use_soap" = "true" ]; then
+ if ! grep -q soap_url "$conf"; then
+ echo "soap_url http://${hostn}/sympasoap" >> "$conf"
+ else
+ perl -pi -e "s%^(soap_url\s+).*%soap_url http://$hostn/sympasoap%" "$conf"
fi
fi
@@ -402,7 +370,7 @@ case $webserver in
;;
esac
- # Check whether the Web server is installed
+# Check whether the Web server is installed
if [ -f /etc/$webserver/httpd.conf ]; then
echo "$webserver: installation seems OK ..."
else
@@ -427,7 +395,7 @@ else
fi
fi
- # Check whether we have to restart the Web server
+# Check whether we have to restart the Web server
db_get wwsympa/webserver_restart
restart="$RET"
diff --git a/debian/sympa.postrm b/debian/sympa.postrm
new file mode 100644
index 0000000..ce79065
--- /dev/null
+++ b/debian/sympa.postrm
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postrm
+dbc_go sympa $@
+
+case "$1" in
+ remove)
+ db_get sympa/use_soap || true
+ use_soap="$RET"
+
+ # Check whether the syslog configuration file is present in case
+ # another system log daemon is used instead of syslog
+ if [ -f /etc/sympa/facility ]; then
+ if perl -ne '/(\S+)/ || exit 1; $ENV{facility}=$1; exit' /etc/sympa/facility \
+ && which syslog-facility >/dev/null 2>&1 \
+ && [ -e /etc/syslog.conf ] \
+ && syslog-facility remove "$facility" \
+ && [ -x /etc/init.d/sysklogd ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d sysklogd reload
+ else
+ etc/init.d/sysklogd reload
+ fi
+ fi
+ rm -f /etc/sympa/facility
+ fi
+
+ if [ "$use_soap" = "true" ]; then
+ # Remove Web server configuration
+ db_get wwsympa/webserver_type
+ webserver="$RET"
+
+ case $webserver in
+ "Apache 2")
+ webserver="apache2"
+ ;;
+ *)
+ webserver="none"
+ ;;
+ esac
+
+ if [ "$use_soap" = "true" ]; then
+ # Remove symbolic link to webserver configuration snippet
+ link=$(readlink /etc/$webserver/conf.d/sympa-soap || true)
+ if [ "$link" = "/etc/sympa/apache-soap" ]; then
+ rm -f /etc/$webserver/conf.d/sympa-soap
+ fi
+ fi
+
+ if [ $webserver != "none" ]; then
+ # Restarting web server if it was requested at configuration time.
+ db_get wwsympa/webserver_restart
+ restart="$RET"
+
+ if [ "$restart" = "true" ]; then
+ if [ -x /etc/init.d/$webserver ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d $webserver force-reload
+ else
+ etc/init.d/$webserver force-reload
+ fi
+ fi
+ # End up with debconf
+ db_stop
+ fi
+ fi
+ fi
+ ;;
+
+ purge)
+ db_input high wwsympa/remove_spool || true
+ db_go
+ db_get wwsympa/remove_spool
+ remove_archives="$RET"
+
+ if [ "$remove_archives" = "true" ]; then
+ echo ""
+ echo "Removing archives and spool subdirectories as requested ..."
+ rm -rf /var/lib/sympa/wwsarchive 2>/dev/null || true
+ rm -rf /var/spool/sympa/wws* 2>/dev/null || true
+ fi
+
+ # Delete the log files if purging, remove aliases too.
+ rm -f /var/log/sympa.log*
+
+ # Remove static content directory
+ if [ -d /var/lib/sympa/static_content ]; then
+ rm -r /var/lib/sympa/static_content
+ fi
+
+ if [ -f /etc/aliases ]; then
+ sed -i -e '/#-- SYMPA begin/,/#-- SYMPA end/d' /etc/aliases
+ newaliases || true
+ fi
+
+ rm -f /etc/sympa/cookie 2>/dev/null || true
+ rm -f /etc/sympa/cookies.history
+
+ # Remove configuration files
+ rm -f /etc/sympa/data_structure.version
+ rm -f /etc/sympa/sympa.conf
+ rm -f /etc/sympa/wwsympa.conf
+
+ # Try to remove if empty
+ rmdir /etc/sympa 2>/dev/null || true
+
+ db_input high sympa/remove_spool || true
+ db_go
+ db_get sympa/remove_spool
+ remove_spool="$RET"
+
+ if [ "$remove_spool" = "true" ]; then
+ echo ""
+ echo "Removing lists data and spool directory as requested ..."
+ rm -rf /var/lib/sympa 2>/dev/null || true
+ rm -rf /var/spool/sympa 2>/dev/null || true
+ fi
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/prerm b/debian/sympa.prerm
similarity index 100%
rename from debian/prerm
rename to debian/sympa.prerm
--
sympa Debian packaging
More information about the Pkg-sympa-commits
mailing list