forked from EternalBlueFlame/Traincraft-5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
79 lines (55 loc) · 1.79 KB
/
setup.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
JAVA_VER=$(javac -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')
echo "JDK version found was:"
echo "$JAVA_VER"
if [ "$JAVA_VER" -ge 19 ]
then
echo "This version is incompatible, 1.9 and later break stuff."
ins_j8;;
elif [ -z "$JAVA_VER" ]
then
ins_j8;;
elif [ ! "$JAVA_VER" -ge 18 ]
then
echo "your java version is too old and doesn't support the methods we need."
insj8;;
fi
JAVA_VER=$(javac -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')
if [ "$JAVA_VER" -ge 18 ]
then
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "Choose an option:"
echo "1: Setup workspace for eclipse (partial setup)."
echo "2: Setup workspace for Intelij IDEA."
echo "3: Compile a jar of the mod."
read -p "" choice
case "$choice" in
1 )
echo "Setting up workspace for Eclipse"
./gradlewLinux setupDecompWorkspace --refresh-dependencies eclipse
;;
2 )
echo "Setting up workspace for Intelij"
./gradlewLinux setupDecompWorkspace --refresh-dependencies idea
;;
3 )
echo "Attempting to build jar file"
./gradlewLinux setupDecompWorkspace --refresh-dependencies build
;;
* ) echo "invalid answer";;
esac
fi
ins_j8() {
read -p "Install Oracle Java Development Kit (JDK) 1.8 (y/n)?" choice
case "$choice" in
y|Y )
echo "Installing Oracle JDK 18."
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
;;
n|N )
echo "Exiting"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1;;
* ) echo "invalid answer";;
esac
}