diff --git a/install_trojan.sh b/install_trojan.sh index f1f641a..8b62626 100755 --- a/install_trojan.sh +++ b/install_trojan.sh @@ -1 +1,33 @@ #!/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 \ No newline at end of file