#! /bin/bash
if [[ -f /etc/redhat-release ]]; then
  release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
  release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
  release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
  release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
  release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
  release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
  release="centos"
else
  echo -e "${red}未检测到系统版本，请联系脚本作者！${plain}\n" && exit 1
fi
if [ "$release" == "centos" ]; then
yum -y install wget curl git unzip
else
apt-get -y install wget curl git unzip
fi
if arch | grep -Eqi "aarch64"; then
wget http://pan.him.plus/shell/edge-node-linux-arm64-plus-v0.3.1.zip
unzip edge-node-linux-arm64-plus-v0.3.1.zip
elif arch | grep -Eqi "x86_64"; then
wget http://pan.him.plus/shell/edge-node-linux-amd64-plus-v0.3.1.zip
unzip edge-node-linux-amd64-plus-v0.3.1.zip
fi
cd edge-node/
bin/edge-node start
