fix function get_versionchange to if -n,reduce indent

pull/114/head
xiagw 2020-09-17 11:43:00 +07:00 committed by IceCodeNew
parent f607e17837
commit cbf08bdb26
1 changed files with 42 additions and 43 deletions

View File

@ -182,11 +182,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
@ -234,10 +237,6 @@ get_version() {
elif [[ "$RELEASE_VERSION" == "$CURRENT_VERSION" ]]; then
return 1
fi
else
RELEASE_VERSION="$(version_number "$VERSION")"
return 2
fi
}
download_v2ray() {