fix function get_versionchange to if -n,reduce indent

pull/107/head
xiagw 2020-09-17 11:43:00 +07:00
parent 684560061f
commit 518a69bfd4
No known key found for this signature in database
GPG Key ID: AA79D99901C34E05
1 changed files with 42 additions and 43 deletions

View File

@ -240,11 +240,14 @@ get_version() {
# 0: Install or update V2Ray.
# 1: Installed or no new version of V2Ray.
# 2: Install the specified version of V2Ray.
if [[ -z "$VERSION" ]]; then
if [[ -n "$VERSION" ]]; then
RELEASE_VERSION="$(version_number "$VERSION")"
return 2
fi
# Determine the version number for V2Ray installed from a local file
if [[ -f '/usr/local/bin/v2ray' ]]; then
VERSION="$(/usr/local/bin/v2ray -version)"
CURRENT_VERSION="$(version_number $(echo "$VERSION" | head -n 1 | awk -F ' ' '{print $2}'))"
CURRENT_VERSION="$(version_number "$(echo "$VERSION" | awk 'NR==1 {print $2}')")"
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
RELEASE_VERSION="$CURRENT_VERSION"
return
@ -292,10 +295,6 @@ get_version() {
elif [[ "$RELEASE_VERSION" == "$CURRENT_VERSION" ]]; then
return 1
fi
else
RELEASE_VERSION="$(version_number "$VERSION")"
return 2
fi
}
download_v2ray() {