5
5
set -e
6
6
isDebugging && set -x
7
7
8
+ worldDownload=/data/tmp/world.zip
9
+ tmpWorldData=/data/tmp/world-data
10
+
8
11
# support absolute directories
9
12
if [[ " ${LEVEL:- world} " =~ ^\/ .* $ ]]; then
10
13
worldDest=${LEVEL}
@@ -27,24 +30,24 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
27
30
if isURL " $WORLD " ; then
28
31
log " Downloading world from $WORLD "
29
32
mkdir -p /data/tmp
30
- if ! get -o /data/tmp/world.bin " $WORLD " ; then
33
+ if ! get -o ${worldDownload} " $WORLD " ; then
31
34
logError " Failed to download world from $WORLD "
32
35
exit 1
33
36
fi
34
- WORLD=/data/tmp/world.bin
37
+ WORLD=${worldDownload}
35
38
fi
36
39
37
40
if [ -f " $WORLD " ]; then
38
41
log " Extracting world"
39
42
40
43
# Stage contents so that the correct subdirectory can be picked off
41
- mkdir -p /data/tmp/world-data
42
- if ! extract " $WORLD " /data/tmp/world-data ; then
44
+ mkdir -p ${tmpWorldData}
45
+ if ! extract " $WORLD " ${tmpWorldData} ; then
43
46
logError " Extracting world from $WORLD "
44
47
exit 1
45
48
fi
46
49
47
- baseDirs=$( find /data/tmp/world-data -name " level.dat" -exec dirname " {}" \; )
50
+ baseDirs=$( find ${tmpWorldData} -name " level.dat" -exec dirname " {}" \; )
48
51
49
52
if ! [[ $baseDirs ]]; then
50
53
logError " World content is not valid since level.dat could not be found"
@@ -129,4 +132,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
129
132
fi
130
133
fi
131
134
135
+ [[ -f ${worldDownload} ]] && rm ${worldDownload}
136
+ [[ -d ${tmpWorldData} ]] && rm -rf ${tmpWorldData}
137
+
132
138
exec " ${SCRIPTS:-/ } start-setupDatapack" " $@ "
0 commit comments