PREIN
/bin/sh
# needed if you have kolab installed
if [ -f "/etc/roundcubemail/kolab.inc.php" ]; then
mv /etc/roundcubemail/kolab.inc.php /etc/roundcubemail/libkolab.inc.php
fi
if [ -L /usr/share/roundcubemail/plugins/enigma/home -a ! -d /usr/share/roundcubemail/plugins/enigma/home ]; then
rm -rf /usr/share/roundcubemail/plugins/enigma/home >/dev/null 2>&1 || :
fi
POSTIN
/bin/sh
if [ "$1" = 1 ]; then
# replace default des string in config file for better security
chars=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A
B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
max=${#chars[*]}
for i in `seq 1 24`; do
let rand=${RANDOM}%${max}
key="${key}${chars[$rand]}"
done
sed -i \
-e "s/\$config\['des_key'\] = '[^']\+';/\$config['des_key'] = '$key';/" \
-e "/YOUR KEY MUST BE DIFFERENT/d" \
/etc/roundcubemail/config.inc.php || : &> /dev/null
fi