update and simplify
This commit is contained in:
@@ -1,43 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=roundcube
|
||||
toolPhpDeps="php\${phpVersion}-gd php\${phpVersion}-ldap php-imagick"
|
||||
readonly toolName=roundcube
|
||||
readonly toolPhpDeps=(curl gd intl ldap mbstring mysql xml zip)
|
||||
readonly toolDeps="php-imagick"
|
||||
#https://github.com/roundcube/roundcubemail/releases/latest
|
||||
latestUrl="https://api.github.com/repos/roundcube/roundcubemail/releases/latest"
|
||||
readonly latestUrl="https://api.github.com/repos/roundcube/roundcubemail/releases/latest"
|
||||
latestVersion=
|
||||
tempExtract=
|
||||
tempInstall=
|
||||
phpVersion=
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
CONFIG=0
|
||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
sq_aptOpt=
|
||||
sq_config=0
|
||||
|
||||
seq_config() {
|
||||
## use sequencer api:
|
||||
initSeqConfig -t "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
if [ $CONFIG -eq 0 ] ; then
|
||||
CONFIG=1
|
||||
if initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||
sq_config=1
|
||||
else
|
||||
# End if no configuration file exists
|
||||
dry || return 1
|
||||
fi
|
||||
|
||||
# Apt cmdline option to suppress user interaction
|
||||
interactive || sq_aptOpt="-y"
|
||||
|
||||
# Return of non zero value will abort the sequence
|
||||
return 0
|
||||
}
|
||||
|
||||
step_1_info() { echo "Install $toolName"; }
|
||||
step_1_alias() { echo "install"; }
|
||||
step_1() {
|
||||
local aptOpt=
|
||||
if quiet;then
|
||||
aptOpt="-y"
|
||||
fi
|
||||
|
||||
downloadLatest
|
||||
fetchPhpVersion
|
||||
|
||||
if [ ! -z $phpVersion ] ; then
|
||||
if [ -n $phpVersion ] ; then
|
||||
exe apt update
|
||||
exe apt install `eval echo "$toolPhpDeps"` $aptOpt
|
||||
exe apt install "${toolPhpDeps[@]/#/php${phpVersion:?}-}" ${toolDeps:?} ${sq_aptOpt:-}
|
||||
fi
|
||||
|
||||
exe chown -R www-data: "$tempExtract"
|
||||
@@ -68,16 +67,18 @@ step_3_info() { echo "Configure $toolName"; }
|
||||
step_3_alias() { echo "config"; }
|
||||
step_3() {
|
||||
echo " [I] Recommended composer packages to be added to \"require\" section:"
|
||||
echo ' "melanie2/mobile": "*",'
|
||||
echo ' "roundcube/carddav": "*",'
|
||||
echo ' "alexandregz/twofactor_gauthenticator": "dev-master"'
|
||||
echo ' "alexandregz/twofactor_gauthenticator": "dev-master",'
|
||||
echo ' "johndoh/contextmenu": "*",'
|
||||
echo ' "kitist/html5_notifier": "*",'
|
||||
echo ' "roundcube/carddav": "*"'
|
||||
|
||||
exe read -p "Copy the lines above and press Enter to continue."
|
||||
exe vi "$RC_LOC/composer.json"
|
||||
step postupgrade
|
||||
|
||||
echo " [I] Generating mysql database $RC_DATABASE"
|
||||
echo
|
||||
exe $WDIR/mysql.sh createdb -c utf8mb4
|
||||
exe ${seq_origin:?}/mysql.sh createdb -c utf8mb4
|
||||
|
||||
echo
|
||||
echo " [I] Now visit: http://url-to-roundcube/installer/"
|
||||
@@ -91,6 +92,7 @@ step_3() {
|
||||
step_10_info() { echo "Configuration notes"; }
|
||||
step_10_alias() { echo "notes"; }
|
||||
step_10() {
|
||||
fetchPhpVersion
|
||||
color green
|
||||
cat <<NOTES_END
|
||||
# smtp port if missing after installation
|
||||
@@ -101,20 +103,10 @@ step_10() {
|
||||
|
||||
# Enable two factor auth (installed with step config) for all user
|
||||
[$RC_LOC/plugins/twofactor_gauthenticator/config.inc.php]
|
||||
$rcmail_config['users_allowed_2FA'] = array('.*');
|
||||
|
||||
# Add mobile skin to roundcube and run step 'postupgrade'.
|
||||
Don't forget to activate plugins if asked for.
|
||||
|
||||
[$RC_LOC/composer.json]
|
||||
"require": {
|
||||
...
|
||||
"mobiledetect/mobiledetectlib": "^2.8",
|
||||
"roundcube/elastic4mobile": "dev-master"
|
||||
}
|
||||
\$rcmail_config['users_allowed_2FA'] = array('.*');
|
||||
|
||||
# Install pspell and aspell spell check engine
|
||||
apt install php7.x-pspell aspell-en aspell-de
|
||||
apt install php${phpVersion}-pspell aspell-en aspell-de
|
||||
|
||||
[$RC_LOC/config/config.inc.php]
|
||||
\$config['spellcheck_engine'] = 'pspell';
|
||||
@@ -142,7 +134,7 @@ TROUBLE_END
|
||||
|
||||
step_20_info() {
|
||||
echo -n "Create a backup"
|
||||
if [ $CONFIG -ne 0 ] ; then
|
||||
if (( ${sq_config} )) ; then
|
||||
echo " at $RC_BACKUP"
|
||||
else
|
||||
echo
|
||||
@@ -150,14 +142,14 @@ step_20_info() {
|
||||
}
|
||||
step_20_alias() { echo "backup"; }
|
||||
step_20() {
|
||||
if [ $CONFIG -eq 0 ] ; then
|
||||
if [ ${sq_config} -eq 0 ] ; then
|
||||
error -e "No configuration file found"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -z $RC_BACKUP ] ; then
|
||||
exe mkdir -p "$RC_BACKUP"
|
||||
fi
|
||||
exe $WDIR/mysql.sh -qq backup "$RC_DATABASE" "$RC_BACKUP"
|
||||
exe ${seq_origin:?}/mysql.sh -qq backup "$RC_DATABASE" "$RC_BACKUP"
|
||||
local wwwBackup="$RC_BACKUP/${toolName}_www_`date +%Y%m%d-%H%M%S`.tar.gz"
|
||||
echo " [I] Backing up webserver directory to $wwwBackup"
|
||||
exe cd "$RC_LOC/.."
|
||||
@@ -254,5 +246,7 @@ downloadLatest() {
|
||||
tempDown="/tmp/roundcube"
|
||||
tempLoc="$tempDown/rc.tar.gz"
|
||||
|
||||
# shellcheck disable=SC2034 # Appears unused
|
||||
readonly sqr_minVersion=16
|
||||
# shellcheck disable=SC1091 # Don't follow this source
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user