feat(查找最优ip): 兼容Mac

pull/534/merge
mack-a 2020-07-31 10:00:49 +08:00
parent e4d0b582cb
commit a8c48a5fe3
1 changed files with 2 additions and 15 deletions

View File

@ -97,25 +97,12 @@ init(){
pingTool pingTool
} }
checkSystem(){ checkSystem(){
if [[ "`uname`" = "Darwin" ]]
if [[ ! -z `find /etc -name "redhat-release"` ]] || [[ ! -z `cat /proc/version | grep -i "centos" | grep -v grep ` ]] || [[ ! -z `cat /proc/version | grep -i "red hat" | grep -v grep ` ]] || [[ ! -z `cat /proc/version | grep -i "redhat" | grep -v grep ` ]]
then then
release="centos" release="Darwin"
installType='yum -y install'
removeType='yum -y remove'
upgrade="yum update -y --skip-broken"
elif [[ ! -z `cat /etc/issue | grep -i "debian" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "debian" | grep -v grep` ]]
then
release="debian"
installType='apt -y install'
upgrade="apt update -y"
removeType='apt -y autoremove'
elif [[ ! -z `cat /etc/issue | grep -i "ubuntu" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "ubuntu" | grep -v grep` ]] elif [[ ! -z `cat /etc/issue | grep -i "ubuntu" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "ubuntu" | grep -v grep` ]]
then then
release="ubuntu" release="ubuntu"
installType='apt -y install'
upgrade="apt update -y"
removeType='apt --purge remove'
fi fi
if [[ -z ${release} ]] if [[ -z ${release} ]]
then then