2020-05-27 18:08:26 +08:00
|
|
|
#!/usr/bin/env bash
|
2020-05-27 21:06:46 +08:00
|
|
|
|
|
|
|
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"
|
|
|
|
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` ]]
|
|
|
|
then
|
|
|
|
release="ubuntu"
|
|
|
|
installType='apt -y install'
|
|
|
|
upgrade="apt update -y"
|
|
|
|
removeType='apt --purge remove'
|
|
|
|
|
|
|
|
fi
|
|
|
|
if [[ -z ${release} ]]
|
|
|
|
then
|
|
|
|
echoContent red "本脚本不支持此系统,请将下方日志反馈给开发者"
|
|
|
|
cat /etc/issue
|
|
|
|
cat /proc/version
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
checkSystem
|