-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch_minecraft_poc.sh
145 lines (124 loc) · 2.38 KB
/
launch_minecraft_poc.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
#!/bin/sh
clear
if [ ! -d ./home/ ]; then
mkdir ./home/
fi
if [ ! -d ./extra/ ]; then
mkdir ./extra/
fi
make_temp_dir() {
if [ ! -d ./temp/ ]; then
mkdir ./temp/
fi
}
remove_temp_dir() {
if [ -d ./temp/ ]; then
rm -r -f ./temp/
fi
}
check_wget() {
if [ ! -f ./bin/wget ]; then
download_wget
fi
}
download_wget() {
curl https://web.archive.org/web/20100514091027/http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz -o ./extra/wget-latest.tar.gz
extract_wget
remove_temp_dir
}
extract_wget() {
make_temp_dir
if [ -f ./bin/pv ]; then
./bin/pv ./extra/wget-latest.tar.gz | tar zxC ./temp/
build_wget
else
download_pv
extract_wget
fi
}
build_wget() {
./temp/wget-1.12/configure --prefix=$PWD && make && make install
}
check_pv() {
if [ ! -f ./bin/pv ]; then
download_pv
fi
}
download_pv() {
echo pv downloader not implemented
}
check_java() {
if [ -f ./bin/java ]; then
java -version
else
download_java
check_java
fi
}
download_java() {
if [ "$arch" = "64" ]; then
./bin/wget -O ./extra/jre-8u151-linux-x64.tar.gz http://old-school-gamer.tk/misc/jre-8u151-linux-x64.tar.gz
else
./bin/wget -O ./extra/jre-8u151-linux-i586.tar.gz http://old-school-gamer.tk/misc/jre-8u151-linux-i586.tar.gz
fi
remove_temp_dir
extract_java
}
extract_java() {
make_temp_dir
if [ "$arch" = "64" ]; then
./bin/pv ./extra/jre-8u151-linux-x64.tar.gz | tar zxC $PWD/temp/;
else
./bin/pv ./extra/jre-8u151-linux-i586.tar.gz | tar zxC $PWD/temp/;
fi
copy_java
}
copy_java() {
if [ -d ./temp/jre1.8.0_151/ ]; then
cp -rp ./temp/jre1.8.0_151/* ./
fi
}
check_os() {
export arch="$(getconf LONG_BIT)"
}
check_minecraft() {
if [ ! -f ./home/Minecraft.jar ]; then
./bin/wget -O ./home/Minecraft.jar http://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar
check_minecraft
else
cd ./bin/
java -jar -Duser.home=$PWD/../home ../home/Minecraft.jar
fi
}
init() {
remove_temp_dir
check_wget
check_pv
check_os
check_java
echo $arch
echo $PATH
echo $HOME
check_java
}
main_menu() {
while true
do
clear
echo "~~~~~~~~~~~~~~~~~~~~~"
echo " M A I N - M E N U"
echo "~~~~~~~~~~~~~~~~~~~~~"
echo "1. Start Minecraft"
echo "2. Exit"
echo "~~~~~~~~~~~~~~~~~~~~~"
local choice
read -p "Enter choice [ 1 - 2] " choice
case $choice in
1) check_minecraft ;;
2) exit 0;;
*) echo -e "${RED}Error...${STD}" && sleep 2
esac
done
}
init
main_menu