Browse Source

refactor: Remove side effect from `sysArch()`

pull/2531/head
xymopen 5 years ago committed by kslr
parent
commit
fa657b8681
  1. 72
      release/install-release.sh

72
release/install-release.sh

@ -25,8 +25,7 @@ ERROR_IF_UPTODATE=''
CUR_VER="" CUR_VER=""
NEW_VER="" NEW_VER=""
ARCH="" VDIS=''
VDIS="64"
ZIPFILE="/tmp/v2ray/v2ray.zip" ZIPFILE="/tmp/v2ray/v2ray.zip"
V2RAY_RUNNING=0 V2RAY_RUNNING=0
@ -98,30 +97,47 @@ colorEcho(){
echo -e "\033[${1}${@:2}\033[0m" 1>& 2 echo -e "\033[${1}${@:2}\033[0m" 1>& 2
} }
sysArch(){ archAffix(){
ARCH=$(uname -m) case "${1:-"$(uname -m)"}" in
if [[ "$ARCH" == "i686" ]] || [[ "$ARCH" == "i386" ]]; then i686|i386)
VDIS="32" echo '32'
elif [[ "$ARCH" == *"armv7"* ]] || [[ "$ARCH" == "armv6l" ]]; then ;;
VDIS="arm" x86_64|amd64)
elif [[ "$ARCH" == *"armv8"* ]] || [[ "$ARCH" == "aarch64" ]]; then echo '64'
VDIS="arm64" ;;
elif [[ "$ARCH" == *"mips64le"* ]]; then *armv7*|armv6l)
VDIS="mips64le" echo 'arm'
elif [[ "$ARCH" == *"mips64"* ]]; then ;;
VDIS="mips64" *armv8*|aarch64)
elif [[ "$ARCH" == *"mipsle"* ]]; then echo 'arm64'
VDIS="mipsle" ;;
elif [[ "$ARCH" == *"mips"* ]]; then *mips64le*)
VDIS="mips" echo 'mips64le'
elif [[ "$ARCH" == *"s390x"* ]]; then ;;
VDIS="s390x" *mips64*)
elif [[ "$ARCH" == "ppc64le" ]]; then echo 'mips64'
VDIS="ppc64le" ;;
elif [[ "$ARCH" == "ppc64" ]]; then *mipsle*)
VDIS="ppc64" echo 'mipsle'
fi ;;
return 0 *mips*)
echo 'mips'
;;
*s390x*)
echo 's390x'
;;
ppc64le)
echo 'ppc64le'
;;
ppc64)
echo 'ppc64'
;;
*)
return 1
;;
esac
return 0
} }
downloadV2Ray(){ downloadV2Ray(){
@ -408,7 +424,9 @@ main(){
[[ "$CHECK" == "1" ]] && checkUpdate && return [[ "$CHECK" == "1" ]] && checkUpdate && return
[[ "$REMOVE" == "1" ]] && remove && return [[ "$REMOVE" == "1" ]] && remove && return
sysArch local ARCH=$(uname -m)
VDIS="$(archAffix)"
# extract local file # extract local file
if [[ $LOCAL_INSTALL -eq 1 ]]; then if [[ $LOCAL_INSTALL -eq 1 ]]; then
colorEcho ${YELLOW} "Installing V2Ray via local file. Please make sure the file is a valid V2Ray package, as we are not able to determine that." colorEcho ${YELLOW} "Installing V2Ray via local file. Please make sure the file is a valid V2Ray package, as we are not able to determine that."

Loading…
Cancel
Save