allow custom directory for extraction

pull/1173/merge
Darien Raymond 6 years ago
parent df5bb77cab
commit 50f7e396c9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -15,6 +15,8 @@ ARCH=""
VDIS="64" VDIS="64"
ZIPFILE="/tmp/v2ray/v2ray.zip" ZIPFILE="/tmp/v2ray/v2ray.zip"
V2RAY_RUNNING=0 V2RAY_RUNNING=0
VSRC_ROOT="/tmp/v2ray"
EXTRACT_ONLY=0
CMD_INSTALL="" CMD_INSTALL=""
CMD_UPDATE="" CMD_UPDATE=""
@ -58,6 +60,13 @@ while [[ $# > 0 ]];do
VERSION="$2" VERSION="$2"
shift shift
;; ;;
--extract)
VSRC_ROOT="$2"
shift
;;
--extractonly)
EXTRACT_ONLY="1"
;;
-l|--local) -l|--local)
LOCAL="$2" LOCAL="$2"
LOCAL_INSTALL="1" LOCAL_INSTALL="1"
@ -154,12 +163,10 @@ getPMT(){
return 0 return 0
} }
VSRC_ROOT=/tmp/v2ray
extract(){ extract(){
colorEcho ${BLUE}"Extracting V2Ray package to /tmp/v2ray." colorEcho ${BLUE}"Extracting V2Ray package to /tmp/v2ray."
mkdir -p /tmp/v2ray mkdir -p /tmp/v2ray
unzip $1 -d "/tmp/v2ray/" unzip $1 -d ${VSRC_ROOT}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
colorEcho ${RED} "Failed to extract V2Ray." colorEcho ${RED} "Failed to extract V2Ray."
return 2 return 2
@ -411,6 +418,12 @@ main(){
extract ${ZIPFILE} || return $? extract ${ZIPFILE} || return $?
fi fi
fi fi
if [[ "${EXTRACT_ONLY}" == "1" ]]; then
colorEcho ${GREEN} "V2Ray extracted to ${VSRC_ROOT}, and exiting..."
return 0
fi
if pgrep "v2ray" > /dev/null ; then if pgrep "v2ray" > /dev/null ; then
V2RAY_RUNNING=1 V2RAY_RUNNING=1
stopV2ray stopV2ray

Loading…
Cancel
Save