fix(脚本): 修改个性化安装后导致的账号不兼容、配置文件替换问题

pull/534/merge
mack-a 2020-10-14 11:51:54 +08:00
parent ed7c545424
commit 36d4af69e8
1 changed files with 21 additions and 21 deletions

View File

@ -1129,7 +1129,7 @@ EOF
elif [[ "$1" = "custom" ]] elif [[ "$1" = "custom" ]]
then then
# log # log
cat << EOF > /etc/v2ray-agent/v2ray/conf/log.json cat << EOF > /etc/v2ray-agent/v2ray/conf/00_log.json
{ {
"log": { "log": {
"access": "/etc/v2ray-agent/v2ray/v2ray_access.log", "access": "/etc/v2ray-agent/v2ray/v2ray_access.log",
@ -1139,7 +1139,7 @@ EOF
} }
EOF EOF
# outbounds # outbounds
cat << EOF > /etc/v2ray-agent/v2ray/conf/outbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/10_outbounds.json
{ {
"outbounds": [ "outbounds": [
{ {
@ -1152,7 +1152,7 @@ EOF
} }
EOF EOF
# dns # dns
cat << EOF > /etc/v2ray-agent/v2ray/conf/dns.json cat << EOF > /etc/v2ray-agent/v2ray/conf/11_dns.json
{ {
"dns": { "dns": {
"servers": [ "servers": [
@ -1169,7 +1169,7 @@ EOF
# 没有path则回落到此端口 # 没有path则回落到此端口
local fallbacksList='{"dest":31296,"xver":0}' local fallbacksList='{"dest":31296,"xver":0}'
if [[ ! -z `echo ${customInstallType}|grep 4` ]] if [[ -z `echo ${customInstallType}|grep 4` ]]
then then
fallbacksList='{"dest":80,"xver":0}' fallbacksList='{"dest":80,"xver":0}'
fi fi
@ -1179,8 +1179,8 @@ EOF
# VLESS_WS_TLS # VLESS_WS_TLS
if [[ ! -z `echo ${customInstallType}|grep 1` ]] if [[ ! -z `echo ${customInstallType}|grep 1` ]]
then then
fallbacksList=${fallbacksList}',{"path":"/${customPath}ws","dest":31297,"xver":1}' fallbacksList=${fallbacksList}',{"path":"/'${customPath}'ws","dest":31297,"xver":1}'
cat << EOF > /etc/v2ray-agent/v2ray/conf/VLESS_WS_inbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/03_VLESS_WS_inbounds.json
{ {
"inbounds":[ "inbounds":[
{ {
@ -1213,14 +1213,15 @@ EOF
# VMess_TCP # VMess_TCP
if [[ ! -z `echo ${customInstallType}|grep 2` ]] if [[ ! -z `echo ${customInstallType}|grep 2` ]]
then then
fallbacksList=${fallbacksList}',{"path":"/${customPath}tcp","dest":31298,"xver":1}' fallbacksList=${fallbacksList}',{"path":"/'${customPath}'tcp","dest":31298,"xver":1}'
cat << EOF > /etc/v2ray-agent/v2ray/conf/VMess_TCP_inbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/04_VMess_TCP_inbounds.json
{ {
"inbounds":[ "inbounds":[
{ {
"port": 31298, "port": 31298,
"listen": "127.0.0.1", "listen": "127.0.0.1",
"protocol": "vmess", "protocol": "vmess",
"tag":"VMessTCP",
"settings": { "settings": {
"clients": [ "clients": [
{ {
@ -1253,13 +1254,14 @@ EOF
# VMess_WS # VMess_WS
if [[ ! -z `echo ${customInstallType}|grep 3` ]] if [[ ! -z `echo ${customInstallType}|grep 3` ]]
then then
fallbacksList=${fallbacksList}',{"path":"/${customPath}","dest":31299,"xver":1}' fallbacksList=${fallbacksList}',{"path":"/'${customPath}'","dest":31299,"xver":1}'
cat << EOF > /etc/v2ray-agent/v2ray/conf/VMess_WS_inbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/05_VMess_WS_inbounds.json
{ {
"inbounds":[ "inbounds":[
{ {
"port": 31299, "port": 31299,
"protocol": "vmess", "protocol": "vmess",
"tag":"VMessWS",
"settings": { "settings": {
"clients": [ "clients": [
{ {
@ -1287,12 +1289,13 @@ EOF
fi fi
# VLESS_TCP # VLESS_TCP
cat << EOF > /etc/v2ray-agent/v2ray/conf/VLESS_TCP_inbounds.json cat << EOF > /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json
{ {
"inbounds":[ "inbounds":[
{ {
"port": 443, "port": 443,
"protocol": "vless", "protocol": "vless",
"tag":"VLESSTCP",
"settings": { "settings": {
"clients": [ "clients": [
{ {
@ -1601,7 +1604,7 @@ showAccounts(){
showStatus=true showStatus=true
# VLESS tcp # VLESS tcp
local tcp=`cat /etc/v2ray-agent/v2ray/conf/VLESS_TCP_inbounds.json|jq .inbounds[0]` local tcp=`cat /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json|jq .inbounds[0]`
local tcpID=`echo ${tcp}|jq .settings.clients[0].id` local tcpID=`echo ${tcp}|jq .settings.clients[0].id`
local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`" local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
@ -1621,7 +1624,7 @@ showAccounts(){
if [[ ! -z `echo ${customInstallType}|grep 1` ]] if [[ ! -z `echo ${customInstallType}|grep 1` ]]
then then
# VLESS ws # VLESS ws
local vlessWS=`cat /etc/v2ray-agent/v2ray/conf/VLESS_WS_inbounds.json|jq .inbounds[0]` local vlessWS=`cat /etc/v2ray-agent/v2ray/conf/03_VLESS_WS_inbounds.json|jq .inbounds[0]`
local vlessWSID=`echo ${vlessWS}|jq .settings.clients[0].id` local vlessWSID=`echo ${vlessWS}|jq .settings.clients[0].id`
local vlessWSAdd=`echo ${tcp}|jq .settings.clients[0].add|awk -F '["]' '{print $2}'` local vlessWSAdd=`echo ${tcp}|jq .settings.clients[0].add|awk -F '["]' '{print $2}'`
local vlessWSEmail="`echo ${vlessWS}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`" local vlessWSEmail="`echo ${vlessWS}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
@ -1633,7 +1636,7 @@ showAccounts(){
if [[ ! -z `echo ${customInstallType}|grep 2` ]] if [[ ! -z `echo ${customInstallType}|grep 2` ]]
then then
local vmessTCP=`cat /etc/v2ray-agent/v2ray/conf/VMess_TCP_inbounds.json|jq .inbounds[0]` local vmessTCP=`cat /etc/v2ray-agent/v2ray/conf/04_VMess_TCP_inbounds.json|jq .inbounds[0]`
local vmessTCPID=`echo ${vmessTCP}|jq .settings.clients[0].id` local vmessTCPID=`echo ${vmessTCP}|jq .settings.clients[0].id`
local vmessTCPEmail="`echo ${vmessTCP}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`" local vmessTCPEmail="`echo ${vmessTCP}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]` local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
@ -1644,7 +1647,7 @@ showAccounts(){
if [[ ! -z `echo ${customInstallType}|grep 3` ]] if [[ ! -z `echo ${customInstallType}|grep 3` ]]
then then
local ws=`cat /etc/v2ray-agent/v2ray/conf/VMess_WS_inbounds.json|jq .inbounds[1]` local ws=`cat /etc/v2ray-agent/v2ray/conf/05_VMess_WS_inbounds.json|jq .inbounds[0]`
local wsID=`echo ${ws}|jq .settings.clients[0].id` local wsID=`echo ${ws}|jq .settings.clients[0].id`
local wsEmail="`echo ${ws}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`" local wsEmail="`echo ${ws}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
local wsPath=`echo ${ws}|jq .streamSettings.wsSettings.path` local wsPath=`echo ${ws}|jq .streamSettings.wsSettings.path`
@ -1760,9 +1763,9 @@ updateV2RayCDN(){
if [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] if [[ -f "/etc/v2ray-agent/v2ray/config.json" ]]
then then
configPath="/etc/v2ray-agent/v2ray/config.json" configPath="/etc/v2ray-agent/v2ray/config.json"
elif [[ -d "/etc/v2ray-agent/v2ray/conf" ]] && [[ -f "/etc/v2ray-agent/v2ray/conf/VLESS_TCP_inbounds.json" ]] elif [[ -d "/etc/v2ray-agent/v2ray/conf" ]] && [[ -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]
then then
configPath="/etc/v2ray-agent/v2ray/conf/VLESS_TCP_inbounds.json" configPath="/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json"
else else
echoContent red " ---> 未安装" echoContent red " ---> 未安装"
exit 0; exit 0;
@ -1955,7 +1958,6 @@ initCustomInstallType(){
then then
while read row while read row
do do
echo row:${row}
if [[ ! -z `echo ${row}|grep VLESS_WS_inbounds` ]] if [[ ! -z `echo ${row}|grep VLESS_WS_inbounds` ]]
then then
customInstallType=${customInstallType}'1' customInstallType=${customInstallType}'1'
@ -1969,8 +1971,6 @@ initCustomInstallType(){
customInstallType=${customInstallType}'3' customInstallType=${customInstallType}'3'
fi fi
done < <(echo `ls /etc/v2ray-agent/v2ray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'`) done < <(echo `ls /etc/v2ray-agent/v2ray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'`)
echo done:${customInstallType}
fi fi
} }
# 主菜单 # 主菜单
@ -1978,7 +1978,7 @@ menu(){
cd cd
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.0.16" echoContent green "当前版本v2.0.17"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本" echoContent green "描述:七合一共存脚本"
echoContent red "==============================================================" echoContent red "=============================================================="