From 117226f9694878b7f514d8872ad225061f2c2dd8 Mon Sep 17 00:00:00 2001 From: kirin10000 <57820613+kirin10000@users.noreply.github.com> Date: Thu, 15 Dec 2022 00:43:00 +0800 Subject: [PATCH] Update install-release.sh --- install-release.sh | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/install-release.sh b/install-release.sh index fa668b8..db0fbdf 100644 --- a/install-release.sh +++ b/install-release.sh @@ -407,42 +407,7 @@ get_latest_version() { } version_gt() { - # compare two version - # 0: $1 > $2 - # 1: $1 <= $2 - - if [[ "$1" != "$2" ]]; then - local temp_1_version_number="${1#v}" - local temp_1_major_version_number="${temp_1_version_number%%.*}" - local temp_1_minor_version_number - temp_1_minor_version_number="$(echo "$temp_1_version_number" | awk -F '.' '{print $2}')" - local temp_1_minimunm_version_number="${temp_1_version_number##*.}" - # shellcheck disable=SC2001 - local temp_2_version_number="${2#v}" - local temp_2_major_version_number="${temp_2_version_number%%.*}" - local temp_2_minor_version_number - temp_2_minor_version_number="$(echo "$temp_2_version_number" | awk -F '.' '{print $2}')" - local temp_2_minimunm_version_number="${temp_2_version_number##*.}" - if [[ "$temp_1_major_version_number" -gt "$temp_2_major_version_number" ]]; then - return 0 - elif [[ "$temp_1_major_version_number" -eq "$temp_2_major_version_number" ]]; then - if [[ "$temp_1_minor_version_number" -gt "$temp_2_minor_version_number" ]]; then - return 0 - elif [[ "$temp_1_minor_version_number" -eq "$temp_2_minor_version_number" ]]; then - if [[ "$temp_1_minimunm_version_number" -gt "$temp_2_minimunm_version_number" ]]; then - return 0 - else - return 1 - fi - else - return 1 - fi - else - return 1 - fi - elif [[ "$1" == "$2" ]]; then - return 1 - fi + test "$(echo -e "$1\\n$2" | sort -V | head -n 1)" != "$1" } download_xray() {