forked from Sterbweise/T5Server
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·195 lines (165 loc) · 6.96 KB
/
install.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
clear
# Colors Section
YELLOW='\033[1;33m'
GREY='\033[1;37m'
PURPLE='\033[0;35m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
# Function Progress
Spinner (){
pid=$!
spin='-\|/'
i=0
while kill -0 $pid 2>/dev/null
do
i=$(( (i+1) %4 ))
printf "\r [${spin:$i:1}] $1"
sleep .1
done
printf "\r [${GREEN}\xE2\x9C\x94${NC}] $1 \n"
}
# Home Section
logo(){
printf "${RED}
888888ba dP dP oo dP oo dP dP dP oo
88 8b 88 88 88 88 88 88
a88aaaa8P 88 dP dP d8888P .d8888b. 88d888b. dP dP dP 88d8b.d8b. 88 dP 88d888b. dP dP dP. .dP 88aaaaa88a .d8888b. .d8888b. d8888P dP 88d888b. .d8888b.
88 88 88 88 88 88' 88 88 88 88 88 88 88' 88' 88 88 88 88' 88 88 88 8bd8 88 88 88' 88 Y8ooooo. 88 88 88' 88 88' 88
88 88 88. .88 88 88. .88 88 88 88 88. .88 88 88 88 88 88 88 88 88. .88 .d88b. 88 88 88. .88 88 88 88 88 88 88. .88
dP dP 88888P dP 88888P dP dP dP 88888P dP dP dP 88888888P dP dP dP 88888P dP dP dP dP 88888P' 88888P' dP dP dP dP 8888P88
.88
d8888P
${NC}
╔══════════════════════════════╗
║ Made by ${BLUE}fra98_${NC} ║
║ Forked from ${PURPLE}Sterbweise${NC} ║
╚══════════════════════════════╝
"
}
logo
echo "Let's update your system first..."
sudo apt update && sudo apt upgrade -y
sleep 3
# Choices Section
mfirewall='Do you want install UFW firewall to allow traffic on this server? (Y/n) ?'
printf "${YELLOW}${mfirewall}${NC}\n"
read -p '>>> ' firewall
echo "Enter the port you want to allow for this specific server (0 if you don't want to set this)"
read -p 'Port Number: ' port
echo "Do you want to enable traffic on HTTP port 8000? (Y/n)"
echo "(This setting it's only useful to set-up FastDL if you need to host modded maps or mods)"
read -p '>>> ' httpcheck
mupdater='Do you need to download the plutonium-updater? (Y/n) ?'
printf "${YELLOW}${mupdater}${NC}\n"
read -p '>>> ' updater
mwine='Do you need to install wine dependencies? (Y/n) ?'
printf "${YELLOW}${mwine}${NC}\n"
read -p '>>> ' winecheck
miw4admin='Do you need to install IW4MAdmin dependencies? (Y/n) ?'
printf "${YELLOW}${miw4admin}${NC}\n"
read -p '>>> ' iw4admin
stty igncr
clear
# Setup Firewall
if [ "$firewall" = 'y' ] || [ "$firewall" = '' ] || [ "$firewall" = 'Y' ] ; then
mfirewall2='Firewall installation and ssh port opening.'
{
sudo apt install ufw fail2ban -y && \
sudo ufw allow 22/tcp && \
sudo ufw default allow outgoing && \
sudo ufw default deny incoming && \
sudo ufw -f enable
#Checking if the chosen server port is available
if [ $port -eq 0 ]; then
echo "Skipping server port configuration..."
else
sudo ufw allow $port && \
if [ $? -eq 0 ]; then
echo "The port $port has been opened"
sudo ufw reload
if [ $? -eq 0 ]; then
echo "The firewall has reloaded"
else
echo "[Error] The firewall could not be reloaded"
fi
else
echo "[Error] The port could not be opened"
fi
fi
#Checking if the chosen http port is available
if [ "$httpcheck" = 'y' ] || [ "$httpcheck" = '' ] || [ "$httpcheck" = 'Y' ] ; then
sudo ufw allow 8000/tcp && \
if [ $? -eq 0 ]; then
echo "The port 8000/tcp has been opened"
sudo ufw reload
if [ $? -eq 0 ]; then
echo "The firewall has reloaded"
else
echo "[Error] The firewall could not be reloaded"
fi
else
echo "[Error] The port could not be opened"
fi
else
echo "Skipping HTTP port configuration..."
fi
} > /dev/null 2>&1 &
Spinner "${mfirewall2}"
fi
# Installing Wine
if [ $winecheck == 'y' ] || [ $winecheck == '' ] || [ $winecheck == 'Y' ] ; then
mwine2='Installing Wine'
{
#Enabling 32bit packages
sudo dpkg --add-architecture i386
sudo apt-get install wget gnupg2 software-properties-common apt-transport-https curl -y
#Installing wine
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt update -y
sudo apt install --install-recommends winehq-staging -y
sudo apt install winetricks -y
# Add Variables to the environment at the end of ~/.bashrc
echo -e 'export WINEPREFIX=~/.wine\nexport WINEDEBUG=fixme-all\nexport WINEARCH=win64' >> ~/.bashrc
echo -e 'export DISPLAY=:0' >> ~/.bashrc
source ~/.bashrc
winecfg
} > /dev/null 2>&1 &
Spinner "${mwine2}"
fi
if [ "$updater" = 'y' ] || [ "$updater" = '' ] || [ "$updater" = 'Y' ] ; then
mupdater2='Downloading plutonium-updater by mxve'
{
# Download plutonium-updater
cd Plutonium/
wget https://github.com/mxve/plutonium-updater.rs/releases/latest/download/plutonium-updater-x86_64-unknown-linux-gnu.tar.gz
tar xfv plutonium-updater-x86_64-unknown-linux-gnu.tar.gz
rm plutonium-updater-x86_64-unknown-linux-gnu.tar.gz
sudo chmod +x plutonium-updater
# Make executable script
sudo chmod +x T4_mp_server.sh
sudo chmod +x T4_zm_server.sh
sudo chmod +x T5_mp_server.sh
sudo chmod +x T5_zm_server.sh
} > /dev/null 2>&1 &
Spinner "${mupdater2}"
fi
if [ "$iw4admin" = 'y' ] || [ "$iw4admin" = '' ] || [ "$iw4admin" = 'Y' ] ; then
miw4admin2='Downloading IW4MAdmin dependencies'
{
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-6.0
} > /dev/null 2>&1 &
Spinner "${miw4admin2}"
fi
mfinish='Installation finished.'
mquit='ENTER to quit.'
printf "\n${GREEN}${mfinish}${NC}\n"
printf "\n${mquit}"
stty -igncr
read
exit