#!/bin/bash # Webmail with Roundcube # ---------------------- source setup/functions.sh # load our functions source /etc/mailinabox.conf # load global vars # ### Installing Rainloop # Rainloop's webpage (http://www.rainloop.net/downloads/) does not easily # # list versions as the need for VERSION_FILENAME below. # # # Dependancies are from Roundcube, not all may be needed for Rainloop # echo "Installing Rainloop (webmail)..." apt_install \ dbconfig-common \ unzip \ php5 php5-sqlite php5-mcrypt php5-intl php5-json php5-common php-auth php-net-smtp php-net-socket php-net-sieve php-mail-mime php-crypt-gpg php5-gd php5-pspell \ tinymce libjs-jquery libjs-jquery-mousewheel libmagic1 apt_get_quiet remove php-mail-mimedecode # no longer needed since Roundcube 1.1.3 # We used to install Roundcube from Ubuntu, without triggering the dependencies #NODOC # on Apache and MySQL, by downloading the debs and installing them manually. #NODOC # Now that we're beyond that, get rid of those debs before installing from source. #NODOC apt-get purge -qq -y roundcube* #NODOC # Install Roundcube from source if it is not already present or if it is out of date. # Combine the Roundcube version number with the commit hash of vacation_sieve to track # whether we have the latest version. VERSION=v1.10.1.127 VERSION_FILENAME="rainloop-community-1.10.1.127-18d553ae9cd96eb102059b04fdee62e0.zip" HASH=bf2b42c99a6d8be151e2c1dc3442604ca709e1ba UPDATE_KEY=$VERSION needs_update=0 #NODOC if [ ! -f /usr/local/lib/rainloop/version ]; then # not installed yet #NODOC needs_update=1 #NODOC elif [[ "$UPDATE_KEY" != "$(cat /usr/local/lib/rainloop/version)" ]]; then # checks if the version is what we want needs_update=1 #NODOC fi if [ $needs_update == 1 ]; then # install rainloop wget_verify \ https://github.com/RainLoop/rainloop-webmail/releases/download/$VERSION/$VERSION_FILENAME \ $HASH \ /tmp/rainloop.zip # Per documentation, updates can overwrite existing files unzip -q -o /tmp/rainloop.zip -d /usr/local/lib/rainloop rm -f /tmp/rainloop.zip # record the version we've installed echo $UPDATE_KEY > /usr/local/lib/rainloop/version fi # ### Configuring Rainloop # Create a configuration file. # # Some application paths are not created until the application is launched # this should include the internal process it has when upgrading between versions # Fix permissions find /usr/local/lib/rainloop -type d -exec chmod 755 {} \; find /usr/local/lib/rainloop -type f -exec chmod 644 {} \; chown -R www-data:www-data /usr/local/lib/rainloop # Fixing permissions needs to happen first or else curl gets # this error: [105] Missing version directory curl -s -L https://$PRIMARY_HOSTNAME/mail/ > /dev/null # Set customized configuration # Rainloop has a default password set, not sure yet how to integrate with userlist # for now we should change it from the default # Methods for changing password: https://github.com/RainLoop/rainloop-webmail/issues/28 # # Untested: edit admin_password = "????" below # # or use the Rainloop API: # /index.php'; # # $oConfig = \RainLoop\Api::Config(); # $oConfig->SetPassword('pa$$wOrd'); # echo $oConfig->Save() ? 'Done' : 'Error'; # # ?> # This can be improved, need to take a look at editconf.py for multi line edits as # there are multiple "enable = On" but we should only edit them per category. cat > /usr/local/lib/rainloop/data/_data_/_default_/configs/application.ini < /usr/local/lib/rainloop/data/_data_/_default_/domains/default.ini <