Skip to content

Commit 2ae6724

Browse files
committed
feat(脚本): 移除centos默认升级、移除semanage、修改centos关闭selinux文章、移除xray grpc相关协议
1 parent 0d7bcca commit 2ae6724

1 file changed

Lines changed: 80 additions & 85 deletions

File tree

install.sh

Lines changed: 80 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ echoContent() {
3434
}
3535
# 检查SELinux状态
3636
checkCentosSELinux() {
37-
if [[ -f "/etc/selinux/config" ]] && ! grep -q "SELINUX=disabled" <"/etc/selinux/config"; then
37+
if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" == "Enforcing" ]; then
3838
echoContent yellow "# 注意事项"
3939
echoContent yellow "检测到SELinux已开启,请手动关闭,教程如下"
40-
echoContent yellow "https://www.v2ray-agent.com/archives/1684115970026#centos7-%E5%85%B3%E9%97%ADselinux"
40+
echoContent yellow "https://www.v2ray-agent.com/archives/1684115970026#centos-%E5%85%B3%E9%97%ADselinux"
4141
exit 0
4242
fi
4343
}
@@ -56,7 +56,7 @@ checkSystem() {
5656
release="centos"
5757
installType='yum -y install'
5858
removeType='yum -y remove'
59-
upgrade="yum update -y --skip-broken"
59+
# upgrade="yum update -y --skip-broken"
6060
checkCentosSELinux
6161
elif { [[ -f "/etc/issue" ]] && grep -qi "Alpine" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "Alpine" /proc/version; }; then
6262
release="alpine"
@@ -698,7 +698,7 @@ allowPort() {
698698
type=tcp
699699
fi
700700
# 如果防火墙启动状态则添加相应的开放端口
701-
if dpkg -l | grep -q "^[[:space:]]*ii[[:space:]]\+ufw"; then
701+
if command -v dpkg >/dev/null 2>&1 && dpkg -l | grep -q "^[[:space:]]*ii[[:space:]]\+ufw"; then
702702
if ufw status | grep -q "Status: active"; then
703703
if ! ufw status | grep -q "$1/${type}"; then
704704
sudo ufw allow "$1/${type}"
@@ -1091,7 +1091,10 @@ installTools() {
10911091

10921092
echoContent green " ---> 检查、安装更新【新机器会很慢,如长时间无反应,请手动停止后重新执行】"
10931093

1094-
${upgrade} >/etc/v2ray-agent/install.log 2>&1
1094+
if [[ "${release}" != "centos" ]]; then
1095+
${upgrade} >/etc/v2ray-agent/install.log 2>&1
1096+
fi
1097+
10951098
if grep <"/etc/v2ray-agent/install.log" -q "changed"; then
10961099
${updateReleaseInfoChange} >/dev/null 2>&1
10971100
fi
@@ -1223,28 +1226,24 @@ installTools() {
12231226
fi
12241227
fi
12251228

1226-
if ! command -v semanage >/dev/null 2>&1; then
1227-
echoContent green " ---> 安装semanage"
1228-
${installType} bash-completion >/dev/null 2>&1
1229-
1230-
if [[ "${centosVersion}" == "7" ]]; then
1231-
policyCoreUtils="policycoreutils-python"
1232-
elif [[ "${centosVersion}" == "8" || "${release}" == "ubuntu" || "${release}" == "debian" ]]; then
1233-
policyCoreUtils="policycoreutils-python-utils"
1234-
fi
1235-
1236-
if [[ -n "${policyCoreUtils}" ]]; then
1237-
${installType} ${policyCoreUtils} >/dev/null 2>&1
1238-
fi
1239-
if [[ -n $(which semanage) ]]; then
1240-
if command -v getenforce >/dev/null 2>&1; then
1241-
selinux_status=$(getenforce)
1242-
if [ "$selinux_status" != "Disabled" ]; then
1243-
semanage port -a -t http_port_t -p tcp 31300
1244-
fi
1245-
fi
1246-
fi
1247-
fi
1229+
# if ! command -v semanage >/dev/null 2>&1 && [[ "${release}" == "centos" ]]; then
1230+
# if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" == "Enforcing" ]; then
1231+
# if [[ "${centosVersion}" == "7" ]]; then
1232+
# policyCoreUtils="policycoreutils-python"
1233+
# elif [[ "${centosVersion}" == "8" || "${centosVersion}" == "9" || "${centosVersion}" == "10" ]]; then
1234+
# policyCoreUtils="policycoreutils-python-utils"
1235+
# fi
1236+
# echoContent green " ---> 安装semanage"
1237+
#
1238+
# if [[ -n "${policyCoreUtils}" ]]; then
1239+
# ${installType} bash-completion >/dev/null 2>&1
1240+
# ${installType} ${policyCoreUtils} >/dev/null 2>&1
1241+
# fi
1242+
# if [[ -n $(which semanage) ]]; then
1243+
# semanage port -a -t http_port_t -p tcp 31300
1244+
# fi
1245+
# fi
1246+
# fi
12481247

12491248
if [[ "${selectCustomInstallType}" == "7" ]]; then
12501249
echoContent green " ---> 检测到无需依赖证书的服务,跳过安装"
@@ -4062,32 +4061,32 @@ EOF
40624061
rm /etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json >/dev/null 2>&1
40634062
fi
40644063
# VLESS_gRPC
4065-
if echo "${selectCustomInstallType}" | grep -q ",5," || [[ "$1" == "all" ]]; then
4066-
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
4067-
{
4068-
"inbounds":[
4069-
{
4070-
"port": 31301,
4071-
"listen": "127.0.0.1",
4072-
"protocol": "vless",
4073-
"tag":"VLESSGRPC",
4074-
"settings": {
4075-
"clients": $(initXrayClients 5),
4076-
"decryption": "none"
4077-
},
4078-
"streamSettings": {
4079-
"network": "grpc",
4080-
"grpcSettings": {
4081-
"serviceName": "${customPath}grpc"
4082-
}
4083-
}
4084-
}
4085-
]
4086-
}
4087-
EOF
4088-
elif [[ -z "$3" ]]; then
4089-
rm /etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json >/dev/null 2>&1
4090-
fi
4064+
# if echo "${selectCustomInstallType}" | grep -q ",5," || [[ "$1" == "all" ]]; then
4065+
# cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
4066+
#{
4067+
# "inbounds":[
4068+
# {
4069+
# "port": 31301,
4070+
# "listen": "127.0.0.1",
4071+
# "protocol": "vless",
4072+
# "tag":"VLESSGRPC",
4073+
# "settings": {
4074+
# "clients": $(initXrayClients 5),
4075+
# "decryption": "none"
4076+
# },
4077+
# "streamSettings": {
4078+
# "network": "grpc",
4079+
# "grpcSettings": {
4080+
# "serviceName": "${customPath}grpc"
4081+
# }
4082+
# }
4083+
# }
4084+
# ]
4085+
#}
4086+
#EOF
4087+
# elif [[ -z "$3" ]]; then
4088+
# rm /etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json >/dev/null 2>&1
4089+
# fi
40914090

40924091
# VLESS Vision
40934092
if echo "${selectCustomInstallType}" | grep -q ",0," || [[ "$1" == "all" ]]; then
@@ -4166,10 +4165,6 @@ EOF
41664165
"clients": $(initXrayClients 7),
41674166
"decryption": "none",
41684167
"fallbacks":[
4169-
{
4170-
"dest": "31305",
4171-
"xver": 1
4172-
}
41734168
]
41744169
},
41754170
"streamSettings": {
@@ -4225,32 +4220,32 @@ EOF
42254220
}
42264221
}
42274222
EOF
4228-
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json
4229-
{
4230-
"inbounds": [
4231-
{
4232-
"port": 31305,
4233-
"listen": "127.0.0.1",
4234-
"protocol": "vless",
4235-
"tag": "VLESSRealityGRPC",
4236-
"settings": {
4237-
"clients": $(initXrayClients 8),
4238-
"decryption": "none"
4239-
},
4240-
"streamSettings": {
4241-
"network": "grpc",
4242-
"grpcSettings": {
4243-
"serviceName": "grpc",
4244-
"multiMode": true
4245-
},
4246-
"sockopt": {
4247-
"acceptProxyProtocol": true
4248-
}
4249-
}
4250-
}
4251-
]
4252-
}
4253-
EOF
4223+
# cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json
4224+
#{
4225+
# "inbounds": [
4226+
# {
4227+
# "port": 31305,
4228+
# "listen": "127.0.0.1",
4229+
# "protocol": "vless",
4230+
# "tag": "VLESSRealityGRPC",
4231+
# "settings": {
4232+
# "clients": $(initXrayClients 8),
4233+
# "decryption": "none"
4234+
# },
4235+
# "streamSettings": {
4236+
# "network": "grpc",
4237+
# "grpcSettings": {
4238+
# "serviceName": "grpc",
4239+
# "multiMode": true
4240+
# },
4241+
# "sockopt": {
4242+
# "acceptProxyProtocol": true
4243+
# }
4244+
# }
4245+
# }
4246+
# ]
4247+
#}
4248+
#EOF
42544249

42554250
elif [[ -z "$3" ]]; then
42564251
rm /etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json >/dev/null 2>&1
@@ -8044,7 +8039,7 @@ customXrayInstall() {
80448039
# echoContent yellow "2.Trojan+TLS+gRPC[仅CDN推荐]"
80458040
echoContent yellow "3.VMess+TLS+WS[仅CDN推荐]"
80468041
echoContent yellow "4.Trojan+TLS[不推荐]"
8047-
echoContent yellow "5.VLESS+TLS+gRPC[仅CDN推荐]"
8042+
# echoContent yellow "5.VLESS+TLS+gRPC[仅CDN推荐]"
80488043
echoContent yellow "7.VLESS+Reality+uTLS+Vision[推荐]"
80498044
# echoContent yellow "8.VLESS+Reality+gRPC"
80508045
echoContent yellow "12.VLESS+Reality+XHTTP+TLS[CDN可用]"
@@ -9536,7 +9531,7 @@ menu() {
95369531
cd "$HOME" || exit
95379532
echoContent red "\n=============================================================="
95389533
echoContent green "作者:mack-a"
9539-
echoContent green "当前版本:v3.5.2"
9534+
echoContent green "当前版本:v3.5.3"
95409535
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
95419536
echoContent green "描述:八合一共存脚本\c"
95429537
showInstallStatus

0 commit comments

Comments
 (0)