-
Notifications
You must be signed in to change notification settings - Fork 3
/
terraria.sh
45 lines (38 loc) · 1.35 KB
/
terraria.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
Dependence="mono-complete unzip screen nano curl"
bit=`uname -m`
VER=$( wget -qO- https://github.com/Pryaxis/TShock/tags | grep -oE -m1 "/tag/v[^\"]*" | cut -dv -f2 )
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
if [[ ${release} == "centos" ]]; then
yum update && yum install $Dependence -y
else
apt-get update && apt-get install $Dependence -y
fi
check_root() {
[[ "$(id -u)" != "0" ]] && echo -e "请用root账号登录!" && exit 1
}
wget -O tshock.zip https://github.com/Pryaxis/TShock/releases/download/${VER}/tshock_${VER}.zip
unzip tshock.zip -d ~/tshock
echo -e "==================================="
echo -e "将在screen中运行Tshock"
echo -e "地图文件在 ~/.local/share/Terraria"
echo -e "==================================="
sleep 3s
cd tshock && screen mono TerrariaServer.exe
exit 1