. /usr/share/debconf/confmodule
if [ "$1" != reconfigure ]; then
- for item in leftwidth themecss; do
- db_fget squirrelmail-cn/${item} seen
- if [ "$RET" = "true" ]; then
- exit 0
- fi
- done
+ for item in leftwidth themecss; do
+ db_fget squirrelmail-cn/${item} seen
+ if [ "$RET" = "true" ]; then
+ exit 0
+ fi
+ done
fi
SMDIR="/etc/squirrelmail"
#
change_default=1
if [ -f "$SMCONF" ]; then
- if egrep -q "^[[:space:]]*\\\$default_left_size[[:space:]]*=[[:space:]]*'220'" "$SMCONF"; then
- change_default=0
- fi
+ if egrep -q "^[[:space:]]*\\\$default_left_size[[:space:]]*=[[:space:]]*'220'" "$SMCONF"; then
+ change_default=0
+ fi
fi
if [ $change_default -eq 1 ]; then
-
- # Ask user for changing $default_left_size to '220'.
- db_input critical squirrelmail-cn/leftwidth || true
- db_go || true
+ # Ask user for changing $default_left_size to '220'.
+ db_input critical squirrelmail-cn/leftwidth || true
+ db_go || true
else
- db_set squirrelmail-cn/leftwidth false || true
- db_fset squirrelmail-cn/leftwidth seen true
- change_default=1
+ db_set squirrelmail-cn/leftwidth false || true
+ db_fset squirrelmail-cn/leftwidth seen true
+ change_default=1
fi
# Check $theme_css in SM's config.php
#
change_default=1
if [ -f "$SMCONF" ]; then
- if egrep -q "^[[:space:]]*\\\$theme_css[[:space:]]*=[[:space:]]*SM_PATH[[:space:]]*\.[[:space:]]*'themes\/css\/squirrelmail-cn\.css'" "$SMCONF"; then
- change_default=0
- fi
+ if egrep -q "^[[:space:]]*\\\$theme_css[[:space:]]*=[[:space:]]*SM_PATH[[:space:]]*\.[[:space:]]*'themes\/css\/squirrelmail-cn\.css'" "$SMCONF"; then
+ change_default=0
+ fi
fi
if [ $change_default -eq 1 ]; then
-
- # Ask user for changing $theme_css to 'squirrelmail-cn.css'.
- db_input critical squirrelmail-cn/themecss || true
- db_go || true
+ # Ask user for changing $theme_css to 'squirrelmail-cn.css'.
+ db_input critical squirrelmail-cn/themecss || true
+ db_go || true
else
- db_set squirrelmail-cn/themecss false || true
- db_fset squirrelmail-cn/themecss seen true
+ db_set squirrelmail-cn/themecss false || true
+ db_fset squirrelmail-cn/themecss seen true
fi
exit 0
set -e
-[ "$DEBIAN_SCRIPT_DEBUG" ] && set -x
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -x
# Source debconf library.
. /usr/share/debconf/confmodule
case "$1" in
- configure)
- # continue below
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- exit 0
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 0
- ;;
+ configure)
+ # continue below
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ exit 0
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 0
+ ;;
esac
unset CP_ECHO_RETURN
mv_old_backups () {
-
- # Clean up /etc, nove old jun^H^H^Hbackups where they belong
- glob="$1.old.*-*-*.*:*:*"
-
- # ${glob%/*} (dirname $glob) does not work for files in root
- if [ -n "$(find ${glob%/*} -name ${glob##*/})" ]; then
- for i in $(find ${glob%/*} -name ${glob##*/})
- do
- cp_backup_conffile "$i" "$2"
- rm -f "$i"
- done
- fi
+ # Clean up /etc, nove old jun^H^H^Hbackups where they belong
+ glob="$1.old.*-*-*.*:*:*"
+
+ # ${glob%/*} (dirname $glob) does not work for files in root
+ if [ -n "$(find ${glob%/*} -name ${glob##*/})" ]; then
+ for i in $(find ${glob%/*} -name ${glob##*/})
+ do
+ cp_backup_conffile "$i" "$2"
+ rm -f "$i"
+ done
+ fi
}
# listconffiles ()
# Returns all configfiles so defined.
#
listconffiles () {
-
- local i incs
-
- incs=`awk 'tolower($1) == "include" { sub("/$","/*",$2); print $2; }' $1`
- if [ -n "$incs" ]; then
- for i in $incs; do
- if [ -e "$i" ]; then echo "$i"; listconffiles "$i"; fi
- done
- fi
+ local i incs
+
+ incs=`awk 'tolower($1) == "include" { sub("/$","/*",$2); print $2; }' $1`
+ if [ -n "$incs" ]; then
+ for i in $incs; do
+ if [ -e "$i" ]; then echo "$i"; listconffiles "$i"; fi
+ done
+ fi
}
# genlocales ()
# is not installed.
#
genlocales () {
-
- if [ -f /usr/lib/locales-all/supported.tar.lzma ] ; then
- cp_echo "CN: locales-all installed, skipping locales generation."
- else
- /usr/sbin/locale-gen
- fi
+ if [ -f /usr/lib/locales-all/supported.tar.lzma ] ; then
+ cp_echo "CN: locales-all installed, skipping locales generation."
+ else
+ locale-gen
+ fi
}
#
if [ -f "$CONF" ]; then
- # Backup first.
- if cp_check_and_backup "$CONF" "$backup_name"; then
- cp_echo "CN: Old $CONF saved as \"/var/backups/$backup_name.bak\"."
- fi
-
- # Check if we already modified apache.conf
- if ! egrep -q "^[ ]+RewriteRule \. https" "$CONF"; then
-
- echo -n "CN: Updating Apache2 configuration for Squirrelmail"
- perl -n -e 'print if ! m|^Alias\s*/webmail|' "$CONF" > $CONF.tmp
-
- cp-update -t squirrelmail-cn $CONF.tmp <<-EOF
- # Force SSL for /webmail -> you can still use /squirrelmail
- Alias /webmail /usr/share/squirrelmail
-
- <IfModule mod_rewrite.c>
- <IfModule mod_ssl.c>
- <Location /webmail>
- RewriteEngine on
- RewriteCond %{HTTPS} !=on
- RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]
- </Location>
- </IfModule>
- </IfModule>
-
- #
- # WARNING: This file is automatically included in each VirtualHost
- # entry you might have. Do not enable the VirtualHost example provided
- # in this file, it WILL break your Apache configuration. Copy the
- # VirtualHost section to the standard webserver configuration file
- # instead.
- #
- EOF
- cp_mv $CONF.tmp $CONF
-
- # This will break if cp_backup_conffile ever changes destination path
- if ! cmp -s "$CONF" "/var/backups/$backup_name.bak"; then
- echo "."
- cp_echo "CN: Updated Apache2 configuration for Squirrelmail."
- need_restart=1
- else
- echo "... no changes."
- fi
+ # Backup first.
+ if cp_check_and_backup "$CONF" "$backup_name"; then
+ cp_echo "CN: Old $CONF saved as \"/var/backups/$backup_name.bak\"."
+ fi
+
+ # Check if we already modified apache.conf
+ if ! egrep -q "^[ ]+RewriteRule \. https" "$CONF"; then
+ echo -n "CN: Updating Apache2 configuration for Squirrelmail"
+ perl -n -e 'print if ! m|^Alias\s*/webmail|' "$CONF" > $CONF.tmp
+
+ cp-update -t squirrelmail-cn $CONF.tmp <<-EOF
+# Force SSL for /webmail -> you can still use /squirrelmail
+Alias /webmail /usr/share/squirrelmail
+
+<IfModule mod_rewrite.c>
+ <IfModule mod_ssl.c>
+ <Location /webmail>
+ RewriteEngine on
+ RewriteCond %{HTTPS} !=on
+ RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]
+ </Location>
+ </IfModule>
+</IfModule>
+
+#
+# WARNING: This file is automatically included in each VirtualHost
+# entry you might have. Do not enable the VirtualHost example provided
+# in this file, it WILL break your Apache configuration. Copy the
+# VirtualHost section to the standard webserver configuration file
+# instead.
+#
+EOF
+ cp_mv $CONF.tmp $CONF
+
+ # This will break if cp_backup_conffile ever changes destination path
+ if ! cmp -s "$CONF" "/var/backups/$backup_name.bak"; then
+ echo "."
+ cp_echo "CN: Updated Apache2 configuration for Squirrelmail."
+ need_restart=1
+ else
+ echo "... no changes."
fi
+ fi
fi
apache2squirrel=`ls -l /etc/apache2/conf.d/ | grep "$CONF"` || true
if [ -z "$apache2listconf" -a -z "$apache2squirrel" ]; then
- ln -s "$CONF" /etc/apache2/conf.d/squirrelmail-cn.conf
- need_restart=1
+ ln -s "$CONF" /etc/apache2/conf.d/squirrelmail-cn.conf
+ need_restart=1
fi
TMPL="$CONFDIR/config_default.php"
mv_old_backups "$CONF" "`basename $CONF`"
if cp_check_and_backup "$CONF"; then
- cp_echo "CN: Old $CONF saved as \"/var/backups/${CONF##*/}.bak\"."
+ cp_echo "CN: Old $CONF saved as \"/var/backups/${CONF##*/}.bak\"."
fi
# We use sed to replace old defaults with ours.
# Must escape \$ because of shell expansion.
#
seddef="/^[ ]*\\\$org_logo[ ]*=/s/sm_logo\.jpg/sm_carnet_logo.png/;
- /^[ ]*\\\$org_logo[ ]*=/s/sm_logo\.png/sm_carnet_logo.png/;
- /^[ ]*\\\$org_logo[ ]*=/s/sm_carnet_logo\.jpg/sm_carnet_logo.png/;
- /^[ ]*\\\$domain[ ]*=/s/mydomain\.com/$domainname/;
- /^[ ]*\\\$default_charset[ ]*=/s/iso-8859-1/iso-8859-2/;
- /^[ ]*\\\$org_logo_width[ ]*=/s/308/0/;
- /^[ ]*\\\$org_logo_height[ ]*=/s/111/0/;
- /^[ ]*\\\$squirrelmail_default_language[ ]*=/s/en_US/hr_HR/;
- /^[ ]*\\\$data_dir[ ]*=/s/\.\.\/data\//\/var\/lib\/squirrelmail\/data\//;
- "
+ /^[ ]*\\\$org_logo[ ]*=/s/sm_logo\.png/sm_carnet_logo.png/;
+ /^[ ]*\\\$org_logo[ ]*=/s/sm_carnet_logo\.jpg/sm_carnet_logo.png/;
+ /^[ ]*\\\$domain[ ]*=/s/mydomain\.com/$domainname/;
+ /^[ ]*\\\$default_charset[ ]*=/s/iso-8859-1/iso-8859-2/;
+ /^[ ]*\\\$org_logo_width[ ]*=/s/308/0/;
+ /^[ ]*\\\$org_logo_height[ ]*=/s/111/0/;
+ /^[ ]*\\\$squirrelmail_default_language[ ]*=/s/en_US/hr_HR/;
+ /^[ ]*\\\$data_dir[ ]*=/s/\.\.\/data\//\/var\/lib\/squirrelmail\/data\//;
+ "
# Left frame size to 220px.
# $default_left_size = '220';
#
db_get squirrelmail-cn/leftwidth || true
if [ "$RET" = "true" ]; then
- seddef="$seddef/^[ ]*\\\$default_left_size[ ]*=/s/'[0-9]*'/'220'/;
- "
+ seddef="$seddef/^[ ]*\\\$default_left_size[ ]*=/s/'[0-9]*'/'220'/;
+ "
fi
# Change CSS file for Squirrelmail.
#
db_get squirrelmail-cn/themecss || true
if [ "$RET" = "true" ]; then
- seddef="$seddef/^[ ]*\\\$theme_css[ ]*=/s/=.*/= SM_PATH . 'themes\/css\/squirrelmail-cn.css';/;
- "
+ seddef="$seddef/^[ ]*\\\$theme_css[ ]*=/s/=.*/= SM_PATH . 'themes\/css\/squirrelmail-cn.css';/;
+ "
fi
db_stop || true
# Check for our dovecot package; if it is installed, assume it's used.
#
if dpkg -l dovecot-cn 2>/dev/null | grep -q '^ii'; then
- seddef="$seddef/^[ ]*\\\$imap_server_type[ ]*=/ {s/cyrus/dovecot/;s/other/dovecot/;s/uw/dovecot/}
- "
+ seddef="$seddef/^[ ]*\\\$imap_server_type[ ]*=/ {s/cyrus/dovecot/;s/other/dovecot/;s/uw/dovecot/}
+ "
fi
# Would there be any changes, perhaps?
#
if cp_check_and_sed '.' "$seddef" "$CONF"; then
- need_restart=1
+ need_restart=1
fi
# Check for hr_HR locale.
#
if [ -f /etc/locale.gen ]; then
- if ! egrep -q '^hr_HR ISO-8859-2\b' /etc/locale.gen; then
- echo "hr_HR ISO-8859-2" >> /etc/locale.gen
- cp_echo "CN: Added hr_HR locale to /etc/locale.gen."
- genlocales
- need_restart=1
- fi
-else
- echo "hr_HR ISO-8859-2" > /etc/locale.gen
- cp_echo "CN: /etc/locale.gen created."
+ if ! egrep -q '^hr_HR ISO-8859-2\b' /etc/locale.gen; then
+ echo "hr_HR ISO-8859-2" >> /etc/locale.gen
+ cp_echo "CN: Added hr_HR locale to /etc/locale.gen."
genlocales
need_restart=1
+ fi
+else
+ echo "hr_HR ISO-8859-2" > /etc/locale.gen
+ cp_echo "CN: /etc/locale.gen created."
+ genlocales
+ need_restart=1
fi
# Check Apache2 web server for restart.
#
if [ $need_restart -eq 1 ]; then
-
- # Restart Apache2 web server.
- if [ -x "/etc/init.d/apache2" ]; then
- if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d apache2 restart || exit $?
- else
- /etc/init.d/apache2 restart || exit $?
- fi
- fi
+ if apache2ctl configtest 2>/dev/null; then
+ invoke-rc.d apache2 force-reload || true
+ else
+ cp_echo "CN: Your Apache2 configuration is either broken or nonexistant."
+ fi
fi
# Mailname info...
#
if [ "$nodots" -o "$nomailname" ]; then
- cp_echo
- cp_echo "CN: Make sure that /etc/mailname contains a fully qualified domain name"
- cp_echo "CN of this machine! Sending mail via squirrelmail might fail if the FQDN"
- cp_echo "CN cannot be found in either /etc/mailname or /etc/hostname."
- cp_echo "CN Read mailname(5) man page for details."
- cp_echo -mailonly "CN If this machine receives mail for both user@`hostname -f` and "
- cp_echo -mailonly "CN user@`hostname -d`, you can also put just the domain in there."
+ cp_echo
+ cp_echo "CN: Make sure that /etc/mailname contains a fully qualified domain name"
+ cp_echo "CN of this machine! Sending mail via squirrelmail might fail if the FQDN"
+ cp_echo "CN cannot be found in either /etc/mailname or /etc/hostname."
+ cp_echo "CN Read mailname(5) man page for details."
+ cp_echo -mailonly "CN If this machine receives mail for both user@`hostname -f` and "
+ cp_echo -mailonly "CN user@`hostname -d`, you can also put just the domain in there."
fi
# Mail root
#
cp_mail "$PKG"
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
exit 0