From 7ced0c8b63922d41a2519dd6c317d27f0c853822 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Wed, 27 May 2020 21:06:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(trojan):=20=E6=B7=BB=E5=8A=A0trojan?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_trojan.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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