feat(查找最优ip): 兼容Mac
parent
e4d0b582cb
commit
a8c48a5fe3
|
@ -97,25 +97,12 @@ init(){
|
|||
pingTool
|
||||
}
|
||||
checkSystem(){
|
||||
|
||||
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
|
||||
release="centos"
|
||||
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` ]]
|
||||
if [[ "`uname`" = "Darwin" ]]
|
||||
then
|
||||
release="debian"
|
||||
installType='apt -y install'
|
||||
upgrade="apt update -y"
|
||||
removeType='apt -y autoremove'
|
||||
release="Darwin"
|
||||
elif [[ ! -z `cat /etc/issue | grep -i "ubuntu" | grep -v grep` ]] || [[ ! -z `cat /proc/version | grep -i "ubuntu" | grep -v grep` ]]
|
||||
then
|
||||
release="ubuntu"
|
||||
installType='apt -y install'
|
||||
upgrade="apt update -y"
|
||||
removeType='apt --purge remove'
|
||||
fi
|
||||
if [[ -z ${release} ]]
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue