From 5b9e632fe4fb062ce154f49a150e2b9c8cc5b1e6 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 3 Jul 2026 12:26:59 +0200 Subject: [PATCH] =?UTF-8?q?upgrade=5Froundcube.sh:=20make=20up=C3=BCgrade?= =?UTF-8?q?=20script=20ready=20for=20newer=20composer=20and=20newer=20roun?= =?UTF-8?q?dcube=20installation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upgrade_roundcube.sh | 86 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/upgrade_roundcube.sh b/upgrade_roundcube.sh index 62ec90f..10c14cc 100755 --- a/upgrade_roundcube.sh +++ b/upgrade_roundcube.sh @@ -4,6 +4,7 @@ clear echo -e "\n \033[32mStart script for upgrading Roundcube Webmailer..\033[m" CUR_IFS="$IFS" +export COMPOSER_ALLOW_SUPERUSER=1 ## ----------------------------------------------------------------- ## ---------------------------------------------------------------- @@ -429,6 +430,9 @@ do echo -e "\n\t\033[33m\033[1mA version number is required!\033[m\n" fi done +# Hauptversionsnummer extrahieren (1.6 oder 1.7) +RC_MAIN_VERSION=$(echo "$ROUNDCUBE_VERSION" | cut -d. -f1-2) + echo "" echo -e "\033[32m--\033[m" echo "" @@ -521,6 +525,7 @@ echo "" echo -e "\033[1;32mSettings for upgrading \033[1;37mRoundcube Webmail\033[m" echo "" echo -e "\tRoundcube Version....................: $ROUNDCUBE_VERSION" +echo -e "\tRoundcube Main Version...............: $RC_MAIN_VERSION" echo "" echo -e "\tName of the Website..................: $WEBSITE_NAME" echo "" @@ -891,12 +896,16 @@ fi echononl "\tRename the composer.json-dist file into composer.json" -cp -a "composer.json-dist" "composer.json" > $log_file 2>&1 -if [[ $? -eq 0 ]]; then - echo_ok +if [ -f "composer.json-dist" ] ; then + cp -a "composer.json-dist" "composer.json" > $log_file 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $log_file)" + fi else - echo_failed - error "$(cat $log_file)" + echo_skipped fi echononl "\tInstall composer to ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}" @@ -954,6 +963,47 @@ while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do done [[ $OK = "yes" ]] || fatal "Abbruch durch User" +# Root-Warning unterdrücken +export COMPOSER_ALLOW_SUPERUSER=1 +export COMPOSER_ROOT_VERSION=${ROUNDCUBE_VERSION} + + +echononl " Allow Plugins .." +php composer.phar --no-interaction config allow-plugins.roundcube/plugin-installer true > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "command was:\n\t # cd "${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}"\n\t # php composer.phar --no-interaction config allow-plugins.roundcube/plugin-installer truen\n$(cat ${log_file})" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" +fi + + +echononl " Deactivate Security-Advisory-Block (for Dev-Deps).." +php composer.phar --no-interaction config policy.advisories.block false > $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "command was:\n\t # cd "${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}"\n\t # php composer.phar --no-interaction config policy.advisories.block false\n\n$(cat ${log_file})" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" +fi echononl " Update dependencies by running 'php composer.phar update --no-dev'" @@ -974,6 +1024,26 @@ else [[ $OK = "yes" ]] || fatal "Abbruch durch User" fi + +echononl " Reactivate Security-Advisory-Block .." +php composer.phar --no-interaction config policy.advisories.block true +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "command was:\n\t # cd "${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}"\n\t #php composer.phar --no-interaction config policy.advisories.block true\ni\n$(cat ${log_file})" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" +fi + + echononl " Index build-in addressbook" ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/bin/indexcontacts.sh > $log_file 2>&1 if [[ $? -eq 0 ]]; then @@ -1006,7 +1076,11 @@ elif [[ -f "${WEBSITE_BASEDIR}/htdocs" ]]; then fi fi -ln -s "roundcubemail-${ROUNDCUBE_VERSION}" "${WEBSITE_BASEDIR}/htdocs" >> $log_file 2>&1 +if [ "$RC_MAIN_VERSION" == "1.7" ]; then + ln -s "roundcubemail-${ROUNDCUBE_VERSION}/public_html/" "${WEBSITE_BASEDIR}/htdocs" >> $log_file 2>&1 +else + ln -s "roundcubemail-${ROUNDCUBE_VERSION}" "${WEBSITE_BASEDIR}/htdocs" >> $log_file 2>&1 +fi if [[ $? -ne 0 ]]; then _failed=true fi