feat(脚本): 兼容centos8
parent
417bf5e3a7
commit
241eb7e1ad
28
install.sh
28
install.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
installType='yum -y install --nobest'
|
installType='yum -y install'
|
||||||
removeType='yum -y remove'
|
removeType='yum -y remove'
|
||||||
upgrade="yum -y update"
|
upgrade="yum -y update"
|
||||||
echoType='echo -e'
|
echoType='echo -e'
|
||||||
|
@ -67,13 +67,20 @@ installTools(){
|
||||||
then
|
then
|
||||||
echoContent green " ---> 检查安装jq、nginx epel源、yum-utils"
|
echoContent green " ---> 检查安装jq、nginx epel源、yum-utils"
|
||||||
# jq epel源
|
# jq epel源
|
||||||
|
if [[ -z `command -v jq` ]]
|
||||||
|
then
|
||||||
rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm > /dev/null 2>&1
|
rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
nginxEpel=""
|
nginxEpel=""
|
||||||
if [[ ! -z `rpm -qa|grep -v grep|grep nginx` ]]
|
if [[ ! -z `rpm -qa|grep -v grep|grep nginx` ]]
|
||||||
|
then
|
||||||
|
local nginxVersion=`rpm -qa|grep -v grep|grep nginx|head -1|awk -F '[-]' '{print $2}'`;
|
||||||
|
if [[ `echo ${nginxVersion}|awk -F '[.]' '{print $1}'` < 1 ]] && [[ `echo ${nginxVersion}|awk -F '[.]' '{print $2}'` < 17 ]]
|
||||||
then
|
then
|
||||||
rpm -qa|grep -v grep|grep nginx|xargs rpm -e > /dev/null 2>&1
|
rpm -qa|grep -v grep|grep nginx|xargs rpm -e > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
if [[ "${centosVersion}" = "6" ]]
|
if [[ "${centosVersion}" = "6" ]]
|
||||||
then
|
then
|
||||||
nginxEpel="http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.18.0-1.el6.ngx.x86_64.rpm"
|
nginxEpel="http://nginx.org/packages/centos/6/x86_64/RPMS/nginx-1.18.0-1.el6.ngx.x86_64.rpm"
|
||||||
|
@ -86,8 +93,16 @@ installTools(){
|
||||||
fi
|
fi
|
||||||
# nginx epel源
|
# nginx epel源
|
||||||
rpm -ivh ${nginxEpel} > /etc/v2ray-agent/error.log 2>&1
|
rpm -ivh ${nginxEpel} > /etc/v2ray-agent/error.log 2>&1
|
||||||
|
|
||||||
# yum-utils
|
# yum-utils
|
||||||
yum install yum-utils --nobest -y > /etc/v2ray-agent/error.log 2>&1
|
if [[ "${centosVersion}" = "8" ]]
|
||||||
|
then
|
||||||
|
installType="yum -y install --nobest"
|
||||||
|
${installType} yum-utils > /etc/v2ray-agent/error.log 2>&1
|
||||||
|
else
|
||||||
|
${installType} yum-utils > /etc/v2ray-agent/error.log 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
# 修复ubuntu个别系统问题
|
# 修复ubuntu个别系统问题
|
||||||
if [[ "${release}" = "ubuntu" ]]
|
if [[ "${release}" = "ubuntu" ]]
|
||||||
|
@ -105,6 +120,7 @@ installTools(){
|
||||||
# then
|
# then
|
||||||
# yum-complete-transaction --cleanup-only
|
# yum-complete-transaction --cleanup-only
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
${upgrade} > /dev/null
|
${upgrade} > /dev/null
|
||||||
if [[ "${release}" = "centos" ]]
|
if [[ "${release}" = "centos" ]]
|
||||||
then
|
then
|
||||||
|
@ -156,7 +172,6 @@ installTools(){
|
||||||
echoContent green " ---> 安装binutils"
|
echoContent green " ---> 安装binutils"
|
||||||
${installType} binutils > /dev/null 2>&1
|
${installType} binutils > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z `find /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin |grep -v grep|grep -w nginx` ]]
|
if [[ -z `find /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin |grep -v grep|grep -w nginx` ]]
|
||||||
then
|
then
|
||||||
echoContent green " ---> 安装nginx"
|
echoContent green " ---> 安装nginx"
|
||||||
|
@ -317,6 +332,7 @@ handleNginx(){
|
||||||
if [[ -z `ps -ef|grep -v grep|grep nginx` ]] && [[ "$1" = "start" ]]
|
if [[ -z `ps -ef|grep -v grep|grep nginx` ]] && [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
nginx
|
nginx
|
||||||
|
sleep 0.5
|
||||||
if [[ -z `ps -ef|grep -v grep|grep nginx` ]]
|
if [[ -z `ps -ef|grep -v grep|grep nginx` ]]
|
||||||
then
|
then
|
||||||
progressTools "red" " Nginx启动失败,请检查日志--->"
|
progressTools "red" " Nginx启动失败,请检查日志--->"
|
||||||
|
@ -844,6 +860,7 @@ handleV2Ray(){
|
||||||
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9
|
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
sleep 0.5
|
||||||
if [[ "$1" = "start" ]]
|
if [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
if [[ ! -z `ps -ef|grep -v grep|grep "v2ray/v2ray"` ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep "v2ray/v2ray"` ]]
|
||||||
|
@ -887,6 +904,7 @@ handleTrojanGo(){
|
||||||
ps -ef|grep -v grep|grep trojan-go|awk '{print $2}'|xargs kill -9
|
ps -ef|grep -v grep|grep trojan-go|awk '{print $2}'|xargs kill -9
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
sleep 0.5
|
||||||
if [[ "$1" = "start" ]]
|
if [[ "$1" = "start" ]]
|
||||||
then
|
then
|
||||||
if [[ ! -z `ps -ef|grep -v grep|grep trojan-go ` ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep trojan-go ` ]]
|
||||||
|
@ -1418,14 +1436,14 @@ menu(){
|
||||||
echoContent magenta "=============================================================="
|
echoContent magenta "=============================================================="
|
||||||
echoContent yellow "3.查看日志[todo]"
|
echoContent yellow "3.查看日志[todo]"
|
||||||
echoContent yellow "4.查看账号"
|
echoContent yellow "4.查看账号"
|
||||||
echoContent white "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
echoContent yellow "5.升级V2Ray"
|
echoContent yellow "5.升级V2Ray"
|
||||||
echoContent yellow "6.升级Trojan-Go"
|
echoContent yellow "6.升级Trojan-Go"
|
||||||
echoContent yellow "7.升级脚本"
|
echoContent yellow "7.升级脚本"
|
||||||
echoContent yellow "8.安装BBR"
|
echoContent yellow "8.安装BBR"
|
||||||
echoContent yellow "9.自动排错"
|
echoContent yellow "9.自动排错"
|
||||||
echoContent yellow "10.更新证书"
|
echoContent yellow "10.更新证书"
|
||||||
echoContent white "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
echoContent yellow "11.卸载脚本"
|
echoContent yellow "11.卸载脚本"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
automaticUpgrade
|
automaticUpgrade
|
||||||
|
|
Loading…
Reference in New Issue