forked from Goobaroo/docker-ftbskies
-
Notifications
You must be signed in to change notification settings - Fork 1
/
launch.sh
57 lines (47 loc) · 1.63 KB
/
launch.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
#!/bin/bash
set -x
if ! [[ -w "/data" ]]; then
echo "Directory is not writable, check permissions for /mnt/user/appdata/"
exit 66
fi
ID=117
VER=11752
cd /data
if ! [[ "$EULA" = "false" ]] || grep -i true eula.txt; then
echo "eula=true" > eula.txt
else
echo "You must accept the EULA by in the container settings."
exit 9
fi
if ! [[ -f serverinstall_${ID}_${VER} ]]; then
rm -f serverinstall_${ID}* forge-*.jar run.sh start.sh
curl -Lo serverinstall_${ID}_${VER} https://api.modpacks.ch/public/modpack/${ID}/${VER}/server/linux
chmod +x serverinstall_${ID}_${VER}
./serverinstall_${ID}_${VER} --path /data --nojava
fi
if [[ -n "$MOTD" ]]; then
sed -i "/motd\s*=/ c motd=$MOTD" /data/server.properties
fi
if [[ -n "$LEVEL" ]]; then
sed -i "/level-name\s*=/ c level-name=$LEVEL" /data/server.properties
fi
if [[ -n "$OPS" ]]; then
echo $OPS | awk -v RS=, '{print}' > ops.txt
fi
if [[ -n "$ALLOWLIST" ]]; then
echo $ALLOWLIST | awk -v RS=, '{print}' > white-list.txt
fi
sed -i 's/server-port.*/server-port=25565/g' server.properties
[[ -f run.sh ]] && chmod 755 run.sh
[[ -f start.sh ]] && chmod 755 start.sh
if [[ -f run.sh || -f start.sh ]]; then
if [[ -f user_jvm_args.txt ]]; then
echo $JVM_OPTS > user_jvm_args.txt
fi
[[ -f run.sh ]] && ./run.sh || ./start.sh
else
rm -f forge-*-installer.jar
FORGE_JAR=$(ls forge-*.jar)
curl -Lo log4j2_112-116.xml https://launcher.mojang.com/v1/objects/02937d122c86ce73319ef9975b58896fc1b491d1/log4j2_112-116.xml
java -server -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -Dfml.queryResult=confirm -Dlog4j.configurationFile=log4j2_112-116.xml $JVM_OPTS -jar $FORGE_JAR nogui
fi