upgrade_roundcube.sh: make upügrade script ready for newer composer and newer roundcube installation.

This commit is contained in:
2026-07-03 12:26:59 +02:00
parent 7be12b675c
commit 5b9e632fe4
+78 -4
View File
@@ -4,6 +4,7 @@ clear
echo -e "\n \033[32mStart script for upgrading Roundcube Webmailer..\033[m" echo -e "\n \033[32mStart script for upgrading Roundcube Webmailer..\033[m"
CUR_IFS="$IFS" 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" echo -e "\n\t\033[33m\033[1mA version number is required!\033[m\n"
fi fi
done done
# Hauptversionsnummer extrahieren (1.6 oder 1.7)
RC_MAIN_VERSION=$(echo "$ROUNDCUBE_VERSION" | cut -d. -f1-2)
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
echo "" echo ""
@@ -521,6 +525,7 @@ echo ""
echo -e "\033[1;32mSettings for upgrading \033[1;37mRoundcube Webmail\033[m" echo -e "\033[1;32mSettings for upgrading \033[1;37mRoundcube Webmail\033[m"
echo "" echo ""
echo -e "\tRoundcube Version....................: $ROUNDCUBE_VERSION" echo -e "\tRoundcube Version....................: $ROUNDCUBE_VERSION"
echo -e "\tRoundcube Main Version...............: $RC_MAIN_VERSION"
echo "" echo ""
echo -e "\tName of the Website..................: $WEBSITE_NAME" echo -e "\tName of the Website..................: $WEBSITE_NAME"
echo "" echo ""
@@ -891,12 +896,16 @@ fi
echononl "\tRename the composer.json-dist file into composer.json" echononl "\tRename the composer.json-dist file into composer.json"
cp -a "composer.json-dist" "composer.json" > $log_file 2>&1 if [ -f "composer.json-dist" ] ; then
if [[ $? -eq 0 ]]; then cp -a "composer.json-dist" "composer.json" > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
echo_failed echo_failed
error "$(cat $log_file)" error "$(cat $log_file)"
fi
else
echo_skipped
fi fi
echononl "\tInstall composer to ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}" echononl "\tInstall composer to ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}"
@@ -954,6 +963,47 @@ while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
done done
[[ $OK = "yes" ]] || fatal "Abbruch durch User" [[ $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'" echononl " Update dependencies by running 'php composer.phar update --no-dev'"
@@ -974,6 +1024,26 @@ else
[[ $OK = "yes" ]] || fatal "Abbruch durch User" [[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi 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" echononl " Index build-in addressbook"
${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/bin/indexcontacts.sh > $log_file 2>&1 ${WEBSITE_BASEDIR}/roundcubemail-${ROUNDCUBE_VERSION}/bin/indexcontacts.sh > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
@@ -1006,7 +1076,11 @@ elif [[ -f "${WEBSITE_BASEDIR}/htdocs" ]]; then
fi fi
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 if [[ $? -ne 0 ]]; then
_failed=true _failed=true
fi fi