33 lines
1.1 KiB
Bash
33 lines
1.1 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
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
|