forked from k1ngzo/RS-2009
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·54 lines (50 loc) · 1.33 KB
/
build.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
#!/bin/sh
origDir=$(pwd)
if [ $# -eq 0 ]; then
echo "Usage: $0 type"
echo "Available types: client, server, ms, all"
exit
else type=$1
fi
build_server() {
echo "Building server..."
cd Server/ || exit
gradle build || exit
cd "$origDir" || exit
tar xvf Server/build/distributions/Server.tar || exit
}
build_client() {
echo "Building client..."
echo "Change IP from 127.0.0.1?(y/N)"
read -r changeIP
if [ "$changeIP" = "y" ]; then
echo "Enter desired IP address:"
read -r newIP
echo "target_ip_addr:$newIP" > Client/src/main/resources/client.conf
fi
cd Client/ || exit
gradle build || exit
cd "$origDir" || exit
tar xvf Client/build/distributions/Client.tar || exit
cp Client/build/libs/client-1.0.0.jar Client/bin/2009scape.jar || exit
echo "Client jarfile can be found at Client/bin/2009scape.jar"
}
build_ms() {
echo "Building management server..."
cd Management-Server/ || exit
gradle build || exit
cd "$origDir" || exit
tar xvf Management-Server/build/distributions/Management-Server.tar || exit
}
if [ "$type" = "client" ]; then
build_client
elif [ "$type" = "server" ]; then
build_server
elif [ "$type" = "ms" ]; then
build_ms
elif [ "$type" = "all" ]; then
build_ms
build_server
build_client
else echo "Invalid type. Should be one of: client, server, ms, all"
fi