mirror of https://github.com/v2ray/v2ray-core
parent
1a7af4f4f1
commit
1c58e74894
|
@ -154,6 +154,7 @@ getPMT(){
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VSRC_ROOT=/
|
||||||
|
|
||||||
extract(){
|
extract(){
|
||||||
colorEcho ${BLUE}"Extracting V2Ray package to /tmp/v2ray."
|
colorEcho ${BLUE}"Extracting V2Ray package to /tmp/v2ray."
|
||||||
|
@ -163,6 +164,12 @@ extract(){
|
||||||
colorEcho ${RED} "Failed to extract V2Ray."
|
colorEcho ${RED} "Failed to extract V2Ray."
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
if [[ -d "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}" ]]; then
|
||||||
|
VSRC_ROOT="/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}"
|
||||||
|
fi
|
||||||
|
if [[ -d "/tmp/v2ray/v2ray-linux-${VDIS}" ]]; then
|
||||||
|
VSRC_ROOT="/tmp/v2ray/v2ray-linux-${VDIS}"
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +228,7 @@ startV2ray(){
|
||||||
|
|
||||||
copyFile() {
|
copyFile() {
|
||||||
NAME=$1
|
NAME=$1
|
||||||
ERROR=`cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/${NAME}" "/usr/bin/v2ray/${NAME}" 2>&1`
|
ERROR=`cp "${VSRC_ROOT}/${NAME}" "/usr/bin/v2ray/${NAME}" 2>&1`
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
colorEcho ${YELLOW} "${ERROR}"
|
colorEcho ${YELLOW} "${ERROR}"
|
||||||
return 1
|
return 1
|
||||||
|
@ -250,7 +257,7 @@ installV2Ray(){
|
||||||
if [[ ! -f "/etc/v2ray/config.json" ]]; then
|
if [[ ! -f "/etc/v2ray/config.json" ]]; then
|
||||||
mkdir -p /etc/v2ray
|
mkdir -p /etc/v2ray
|
||||||
mkdir -p /var/log/v2ray
|
mkdir -p /var/log/v2ray
|
||||||
cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/vpoint_vmess_freedom.json" "/etc/v2ray/config.json"
|
cp "${VSRC_ROOT}/vpoint_vmess_freedom.json" "/etc/v2ray/config.json"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
colorEcho ${YELLOW} "Failed to create V2Ray configuration file. Please create it manually."
|
colorEcho ${YELLOW} "Failed to create V2Ray configuration file. Please create it manually."
|
||||||
return 1
|
return 1
|
||||||
|
@ -272,14 +279,14 @@ installInitScript(){
|
||||||
if [[ -n "${SYSTEMCTL_CMD}" ]];then
|
if [[ -n "${SYSTEMCTL_CMD}" ]];then
|
||||||
if [[ ! -f "/etc/systemd/system/v2ray.service" ]]; then
|
if [[ ! -f "/etc/systemd/system/v2ray.service" ]]; then
|
||||||
if [[ ! -f "/lib/systemd/system/v2ray.service" ]]; then
|
if [[ ! -f "/lib/systemd/system/v2ray.service" ]]; then
|
||||||
cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/systemd/v2ray.service" "/etc/systemd/system/"
|
cp "${VSRC_ROOT}/systemd/v2ray.service" "/etc/systemd/system/"
|
||||||
systemctl enable v2ray.service
|
systemctl enable v2ray.service
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
elif [[ -n "${SERVICE_CMD}" ]] && [[ ! -f "/etc/init.d/v2ray" ]]; then
|
elif [[ -n "${SERVICE_CMD}" ]] && [[ ! -f "/etc/init.d/v2ray" ]]; then
|
||||||
installSoftware "daemon" || return $?
|
installSoftware "daemon" || return $?
|
||||||
cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/systemv/v2ray" "/etc/init.d/v2ray"
|
cp "${VSRC_ROOT}/systemv/v2ray" "/etc/init.d/v2ray"
|
||||||
chmod +x "/etc/init.d/v2ray"
|
chmod +x "/etc/init.d/v2ray"
|
||||||
update-rc.d v2ray defaults
|
update-rc.d v2ray defaults
|
||||||
fi
|
fi
|
||||||
|
@ -371,21 +378,22 @@ main(){
|
||||||
sysArch
|
sysArch
|
||||||
# extract local file
|
# extract local file
|
||||||
if [[ $LOCAL_INSTALL -eq 1 ]]; then
|
if [[ $LOCAL_INSTALL -eq 1 ]]; then
|
||||||
echo "Installing V2Ray via local file"
|
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."
|
||||||
|
NEW_VER=local
|
||||||
installSoftware unzip || return $?
|
installSoftware unzip || return $?
|
||||||
rm -rf /tmp/v2ray
|
rm -rf /tmp/v2ray
|
||||||
extract $LOCAL || return $?
|
extract $LOCAL || return $?
|
||||||
FILEVDIS=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f4`
|
#FILEVDIS=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f4`
|
||||||
SYSTEM=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f3`
|
#SYSTEM=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f3`
|
||||||
if [[ ${SYSTEM} != "linux" ]]; then
|
#if [[ ${SYSTEM} != "linux" ]]; then
|
||||||
colorEcho ${RED} "The local V2Ray can not be installed in linux."
|
# colorEcho ${RED} "The local V2Ray can not be installed in linux."
|
||||||
return 1
|
# return 1
|
||||||
elif [[ ${FILEVDIS} != ${VDIS} ]]; then
|
#elif [[ ${FILEVDIS} != ${VDIS} ]]; then
|
||||||
colorEcho ${RED} "The local V2Ray can not be installed in ${ARCH} system."
|
# colorEcho ${RED} "The local V2Ray can not be installed in ${ARCH} system."
|
||||||
return 1
|
# return 1
|
||||||
else
|
#else
|
||||||
NEW_VER=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f2`
|
# NEW_VER=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f2`
|
||||||
fi
|
#fi
|
||||||
else
|
else
|
||||||
# download via network and extract
|
# download via network and extract
|
||||||
installSoftware "curl" || return $?
|
installSoftware "curl" || return $?
|
||||||
|
|
Loading…
Reference in New Issue