add source parameter in install-release script

pull/1546/head
Darien Raymond 2019-02-07 23:15:17 +01:00
parent a499f90b42
commit a167073bbc
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 11 additions and 2 deletions

View File

@ -18,6 +18,7 @@ V2RAY_RUNNING=0
VSRC_ROOT="/tmp/v2ray" VSRC_ROOT="/tmp/v2ray"
EXTRACT_ONLY=0 EXTRACT_ONLY=0
ERROR_IF_UPTODATE=0 ERROR_IF_UPTODATE=0
DIST_SRC="github"
CMD_INSTALL="" CMD_INSTALL=""
CMD_UPDATE="" CMD_UPDATE=""
@ -73,6 +74,10 @@ while [[ $# > 0 ]];do
LOCAL_INSTALL="1" LOCAL_INSTALL="1"
shift shift
;; ;;
--source)
DIST_SRC="$2"
shift
;;
--errifuptodate) --errifuptodate)
ERROR_IF_UPTODATE="1" ERROR_IF_UPTODATE="1"
;; ;;
@ -118,8 +123,12 @@ sysArch(){
downloadV2Ray(){ downloadV2Ray(){
rm -rf /tmp/v2ray rm -rf /tmp/v2ray
mkdir -p /tmp/v2ray mkdir -p /tmp/v2ray
colorEcho ${BLUE} "Downloading V2Ray." if [[ "${DIST_SRC}" == "jsdelivr" ]]; then
DOWNLOAD_LINK="https://cdn.jsdelivr.net/gh/v2ray/dist/v2ray-linux-${VDIS}.zip"
else
DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${NEW_VER}/v2ray-linux-${VDIS}.zip" DOWNLOAD_LINK="https://github.com/v2ray/v2ray-core/releases/download/${NEW_VER}/v2ray-linux-${VDIS}.zip"
fi
colorEcho ${BLUE} "Downloading V2Ray: ${DOWNLOAD_LINK}"
curl ${PROXY} -L -H "Cache-Control: no-cache" -o ${ZIPFILE} ${DOWNLOAD_LINK} curl ${PROXY} -L -H "Cache-Control: no-cache" -o ${ZIPFILE} ${DOWNLOAD_LINK}
if [ $? != 0 ];then if [ $? != 0 ];then
colorEcho ${RED} "Failed to download! Please check your network or try again." colorEcho ${RED} "Failed to download! Please check your network or try again."