db_get roundcube/language || true
language="$RET"
+
+ # Get current 3DES key from /etc/roundcube/main.inc.php
+ [ -f /etc/roundcube/main.inc.php ] && {
+ deskey=$(sed -n "s+^\$rcmail_config\['des_key'\] = '\(.*\)';\$+\1+p" \
+ /etc/roundcube/main.inc.php)
+ }
+ # If this is the default key, forget it !
+ [ "$deskey" = "rcmail-!24ByteDESkey*Str" ] && unset deskey
+ # Generate a new one
+ while [ -z "$deskey" ]; do
+ deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | \
+ tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
+ done
+
+ # Put hosts, language and key in main.inc.php
zcat /usr/share/doc/roundcube/main.inc.php.dist.gz | \
sed -e "s+^\(\$rcmail_config\['default_host'\] = \)''\(;\)\$+\1${hosts}\2+" \
+ -e "s+^\(\$rcmail_config\['des_key'\] = '\).*\(';\)\$+\1$deskey\2+" \
-e "s+^\(\$rcmail_config\['locale_string'\] = '\).*\(';\)\$+\1${language}\2+" >> $CONFFILE.ucftmp
ucf --debconf-ok $CONFFILE.ucftmp $CONFFILE