Преглед изворни кода

Fix bug in upgrade logic (#3330)

* Fix upgrade logic bug

* Improve version check

jq -r .version /usr/share/phpmyadmin/package.json will not break if system accidentally upgrades to an older version (pre 1.3 installs)
Jaap Marcus пре 3 година
родитељ
комит
80bfd766f8
1 измењених фајлова са 5 додато и 5 уклоњено
  1. 5 5
      func/upgrade.sh

+ 5 - 5
func/upgrade.sh

@@ -578,8 +578,8 @@ upgrade_phppgadmin() {
 upgrade_phpmyadmin() {
 	# Check if MariaDB/MySQL is installed on the server before attempting to install or upgrade phpMyAdmin
 	if [ -n "$(echo $DB_SYSTEM | grep -w 'mysql')" ]; then
-		pma_release_file=$(ls /usr/share/phpmyadmin/RELEASE-DATE-* 2> /dev/null | tail -n 1)
-		if version_ge "${pma_release_file##*-}" "$pma_v"; then
+		pma_version=$(jq -r .version /usr/share/phpmyadmin/package.json)
+		if version_ge "$pma_version" "$pma_v"; then
 			echo "[ * ] phpMyAdmin is up to date (${pma_release_file##*-})..."
 			# Update permissions
 			if [ -e /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then
@@ -634,7 +634,7 @@ upgrade_filemanager() {
 		else
 			fm_version="1.0.0"
 		fi
-		if version_ge "$fm_version" "$fm_v"; then
+		if ! version_ge "$fm_version" "$fm_v"; then
 			echo "[ ! ] Upgrading File Manager to version $fm_v..."
 			# Reinstall the File Manager
 			$BIN/v-delete-sys-filemanager quiet yes
@@ -662,7 +662,7 @@ upgrade_roundcube() {
 			echo "      To upgrade to the latest version of Roundcube directly from upstream, from please run the command migrate_roundcube.sh located in: /usr/local/hestia/install/upgrade/manual/"
 		else
 			rc_version=$(cat /var/lib/roundcube/index.php | grep -o -E '[0-9].[0-9].[0-9]+' | head -1)
-			if version_ge "$rc_version" "$rc_v"; then
+			if ! version_ge "$rc_version" "$rc_v"; then
 				echo "[ ! ] Upgrading Roundcube to version $rc_v..."
 				$BIN/v-add-sys-roundcube
 			else
@@ -675,7 +675,7 @@ upgrade_roundcube() {
 upgrade_rainloop() {
 	if [ -n "$(echo "$WEBMAIL_SYSTEM" | grep -w 'rainloop')" ]; then
 		rl_version=$(cat /var/lib/rainloop/data/VERSION)
-		if version_ge "$rl_version" "$rl_v"; then
+		if ! version_ge "$rl_version" "$rl_v"; then
 			echo "[ ! ] Upgrading Rainloop to version $rl_v..."
 			$BIN/v-add-sys-rainloop
 		else