Skip to content

Commit 3c76998

Browse files
authored
Update 30-nextcloud
Fix the incorrect comparisons in version_greater function
1 parent 2cc1a27 commit 3c76998

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: install/assets/functions/30-nextcloud

+4-3
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ directory_empty() {
386386

387387
version_greater() {
388388
# version_greater A B returns whether A > B
389-
ver1_main=${1%-*}
390-
ver2_main=${2%-*}
389+
ver1_main=$(echo "$1" | grep -o '^[0-9.]*')
390+
ver2_main=$(echo "$2" | grep -o '^[0-9.]*')
391+
391392
ver1_pre=${1#"$ver1_main"}
392393
ver2_pre=${2#"$ver2_main"}
393394

@@ -397,7 +398,7 @@ version_greater() {
397398
else
398399
# If one version has a pre-release part and the other doesn't, consider the one without pre-release greater
399400
if [ -z "$ver1_pre" ] && [ -n "$ver2_pre" ]; then
400-
return 0
401+
return 0 # Stable version > Pre-release version
401402
elif [ -n "$ver1_pre" ] && [ -z "$ver2_pre" ]; then
402403
return 1
403404
else

0 commit comments

Comments
 (0)