1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-30 07:46:41 -04:00

Merge pull request #1038 from sunshineplan/3

install-release.sh中copyFile功能简化
This commit is contained in:
DarienRaymond 2018-04-12 10:46:32 +02:00 committed by GitHub
commit 7ead80c792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,14 +205,12 @@ startV2ray(){
copyFile() { copyFile() {
NAME=$1 NAME=$1
MANDATE=$2
ERROR=`cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/${NAME}" "/usr/bin/v2ray/${NAME}" 2>&1` ERROR=`cp "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}/${NAME}" "/usr/bin/v2ray/${NAME}" 2>&1`
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
colorEcho ${YELLOW} "${ERROR}" colorEcho ${YELLOW} "${ERROR}"
if [ "$MANDATE" = true ]; then return 2
exit
fi
fi fi
return 0
} }
makeExecutable() { makeExecutable() {
@ -222,12 +220,12 @@ makeExecutable() {
installV2Ray(){ installV2Ray(){
# Install V2Ray binary to /usr/bin/v2ray # Install V2Ray binary to /usr/bin/v2ray
mkdir -p /usr/bin/v2ray mkdir -p /usr/bin/v2ray
copyFile v2ray true copyFile v2ray || return $?
makeExecutable v2ray makeExecutable v2ray
copyFile v2ctl false copyFile v2ctl
makeExecutable v2ctl makeExecutable v2ctl
copyFile geoip.dat false copyFile geoip.dat
copyFile geosite.dat false copyFile geosite.dat
# Install V2Ray server config to /etc/v2ray # Install V2Ray server config to /etc/v2ray
if [[ ! -f "/etc/v2ray/config.json" ]]; then if [[ ! -f "/etc/v2ray/config.json" ]]; then
@ -388,7 +386,7 @@ main(){
V2RAY_RUNNING=1 V2RAY_RUNNING=1
stopV2ray stopV2ray
fi fi
installV2Ray installV2Ray || return $?
installInitScript installInitScript
if [[ ${V2RAY_RUNNING} -eq 1 ]];then if [[ ${V2RAY_RUNNING} -eq 1 ]];then
colorEcho ${BLUE} "Restarting V2Ray service." colorEcho ${BLUE} "Restarting V2Ray service."