1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-05 15:57:23 +01:00

Add setup mods for testing the latest version of roundcube

This commit is contained in:
downtownallday
2022-02-25 19:32:29 -05:00
parent c3ac810c19
commit fe2079ee8f
4 changed files with 318 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
#!/bin/bash
#
# this mod will run composer on rcmcarddav to update its dependencies
#
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
echo "Updating rcmcarddav's dependencies"
# where webmail.sh installs roundcube
RCM_DIR=/usr/local/lib/roundcubemail
install_composer() {
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
local EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
local ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
return 1
fi
php composer-setup.php --quiet
local RESULT=$?
rm composer-setup.php
[ $RESULT -eq 0 ] && return 0
return 1
}
cd "$RCM_DIR"
# install composer into root of roundcubemail
if [ ! -e "composer.phar" ]; then
install_composer
fi
# update dependencies
cd "plugins/carddav"
../../composer.phar install --no-interaction --no-plugins --no-dev

View File

@@ -0,0 +1,28 @@
#!/bin/bash
#
# this mod will enable roundcube debugging output. output goes
# /var/log/roundcubemail
#
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
# where webmail.sh installs roundcube
RCM_DIR=/usr/local/lib/roundcubemail
CONF=${1:-$RCM_DIR/config/config.inc.php}
php tools/editconf.php $CONF config \
'log_driver' 'file' \
'syslog_facility' 'constant("LOG_MAIL")' \
'debug_level' '4' \
'imap_debug' 'true' \
'imap_log_session' 'true' \
'sql_debug' 'true' \
'smtp_debug' 'true' \
'session_debug' 'true' \
'log_logins' 'true' \
'log_errors' 'true' \
'per_user_logging' 'false' \
'session_lifetime' '2'

View File

@@ -0,0 +1,120 @@
#!/bin/bash
#
# this mod will install the latest master branch version of roundcube
#
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
echo "Installing latest Roundcube master branch"
# where webmail.sh installs roundcube
RCM_DIR=/usr/local/lib/roundcubemail
# source files of the master branch
master_zip_url="https://github.com/roundcube/roundcubemail/archive/master.zip"
# git clone url
master_git_url="https://github.com/roundcube/roundcubemail.git"
master_tag="${RC_CLONE_TAG:-master}"
install_composer() {
# https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
local EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
local ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
return 1
fi
php composer-setup.php --quiet
local RESULT=$?
rm composer-setup.php
[ $RESULT -eq 0 ] && return 0
return 1
}
process_zip() {
zip="/tmp/roundcube-master.zip"
hide_output wget -O "$zip" "$master_zip_url"
# set working directory to /usr/local/lib
pushd $(dirname "$RCM_DIR") >/dev/null
# rename active installation directory (/usr/local/lib/roundcubemail)
# to roundcubemail-master so current installation is overwritten
# during unzip
mv $(basename "$RCM_DIR") roundcubemail-master
# unzip master sources, overwriting current installation
unzip -q -o "$zip"
# rename back to expected installation directory
mv roundcubemail-master $(basename "$RCM_DIR")
# remove the temp file
rm -f "$zip"
}
process_git() {
# set working directory to /usr/local/lib
pushd $(dirname "$RCM_DIR") >/dev/null
# clone to roundcubemail-master
git clone --branch "$master_tag" --depth 1 "$master_git_url" "roundcubemail-master"
# checkout the desired branch/ref
cd "roundcubemail-master"
# if [ ! -e "program/steps/login/oauth.inc" ]; then
# git checkout `git rev-list -n 1 --before="2020-10-02 00:00" master`
# fi
# copy and overwrite existing installation
tar cf - . | (cd "$RCM_DIR"; tar xf -)
# remove clone
cd ..
rm -rf "roundcubemail-master"
}
process_git
# run composer to update dependencies
cd "$RCM_DIR"
# 1. install 'dist' composer.json that came with master
if [ -e "composer.json" -a ! -e "composer.json.orig" ]; then
mv composer.json composer.json.orig
fi
if [ -e "composer.lock" -a ! -e "composer.lock.orig" ]; then
mv composer.lock composer.lock.orig
fi
rm -f composer.json
rm -f composer.lock
cp composer.json-dist composer.json
# 2. install composer
if [ ! -e "composer.phar" ]; then
install_composer
fi
# 3. update dependencies
php composer.phar --no-interaction --no-plugins --no-dev install
php composer.phar --no-interaction --no-plugins require "kolab/net_ldap3"
# revert working directory
popd >/dev/null
# done
echo "Roundcube sources from $master_tag branch successfully installed"