Generate webmail configuration

This commit is contained in:
Bob Mottram 2016-04-25 20:17:10 +01:00
parent b067a9b2f6
commit 36b2c46b0c
1 changed files with 19 additions and 3 deletions

View File

@ -8868,8 +8868,10 @@ function install_webmail {
repair_databases_script
apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
apt-get -y install php5-dev imagemagick php5-imagick
apt-get -y install php5-dev imagemagick php5-imagick php5-sqlite php-auth-sasl php-net-smtp php-mime-type
apt-get -y install php-mail-mime php-mail-mimedecode php-net-ldap3
pear install Net_IDNA2
if [ ! -f $WEBMAIL_PATH/index.php ]; then
cd $WEB_PATH
git_clone $WEBMAIL_REPO webmail
@ -8880,7 +8882,6 @@ function install_webmail {
else
sed -i "s/Webmail commit.*/Webmail commit:$WEBMAIL_COMMIT/g" $COMPLETION_FILE
fi
chown -R www-data:www-data $WEBMAIL_PATH
fi
if [ ! -f $WEBMAIL_PATH/index.php ]; then
echo $'Did not clone webmail repo'
@ -8904,6 +8905,21 @@ function install_webmail {
mkdir -p /var/www/$DEFAULT_DOMAIN_NAME/htdocs
fi
ln -s $WEBMAIL_PATH /var/www/$DEFAULT_DOMAIN_NAME/htdocs/webmail
if [ ! -f /var/www/webmail/config/config.inc.php ]; then
# generate the configuration
echo '<?php' > /var/www/webmail/config/config.inc.php
echo "\$config['db_dsnw'] = 'mysql://webmailadmin:${WEBMAIL_ADMIN_PASSWORD}@localhost/webmail';" >> /var/www/webmail/config/config.inc.php
echo "\$config['default_host'] = 'localhost';" >> /var/www/webmail/config/config.inc.php
echo "\$config['support_url'] = '';" >> /var/www/webmail/config/config.inc.php
WEBMAIL_DES_KEY="$(openssl rand -base64 32 | cut -c1-25)"
echo "\$config['des_key'] = '${WEBMAIL_DES_KEY}';" >> /var/www/webmail/config/config.inc.php
echo "\$config['product_name'] = '${PROJECT_NAME}';" >> /var/www/webmail/config/config.inc.php
echo "$config['plugins'] = array('enigma');" >> /var/www/webmail/config/config.inc.php
echo "$config['mime_param_folding'] = 0;" >> /var/www/webmail/config/config.inc.php
fi
chown -R www-data:www-data $WEBMAIL_PATH
if ! grep -q "Webmail" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README