-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.sh
77 lines (62 loc) · 1.56 KB
/
main.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
echo "This script will install the things needed for creating Minecraft server or launching existing server."
echo "This script is created by denizxs. If you're having problems with this script report on GitHub page"
echo "Use this script at your own risk."
sleep 2
versions=versions.txt
#Installing Dependecies
while true;do
read -p "Do you want to install dependecies? (y/n)" -r yn
case "$yn" in
[Nn]* )
break;;
esac
case "$yn" in
[Yy]* ) pkg install openssl zlib wget openjdk-17
break;;
esac
done
#Server Installation
while true;do
read -p "Do you want to create server? (y/n)" -r yn
case "$yn" in
[Nn]* ) exit
break;;
esac
case "$yn" in
[Yy]* )
break;;
esac
done
#Server Creation
while true; do
echo "What do you want the server name to be?"
read foldername
if [ -z "$foldername" ]; then
echo "Invalid input. Please try again."
else
echo "Server folder name is $foldername"
mkdir $foldername
break
fi
done
#Server Version
echo "Which version do you want?"
select LINE in $(awk -F'|' '{print $1}' $versions); do
if [ -n "$LINE" ]; then
downloadurl=$(grep "^$LINE|" $versions | awk -F'|' '{print $2}')
if [ -n "$downloadurl" ]; then
break
else
echo "Invalid input. Please try again.."
fi
else
echo "Invalid input. Please try again."
fi
done
#Installing and Starting Server
cd $foldername
wget $downloadurl
chmod +x server.jar
java -jar server.jar
sed -i -e 's/false/true/g' eula.txt
echo "You can now launch server from other script and don't forget to change server settings. Have fun!"