Skip to content

Commit 68fa2d6

Browse files
authored
Download bedrock zip into temp directory under /data (#251)
1 parent 3c6b445 commit 68fa2d6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bedrock-entry.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
set -eo pipefail
44

5+
: "${TMP_DIR:=/data/tmp}"
6+
57
if [[ ${DEBUG^^} = TRUE ]]; then
68
set -x
79
curlArgs=(-v)
810
echo "DEBUG: running as $(id -a) with $(ls -ld /data)"
11+
echo " current directory is $(pwd)"
912
fi
1013

1114
downloadPage=https://www.minecraft.net/en-us/download/server/bedrock
@@ -84,7 +87,8 @@ if [ ! -f "bedrock_server-${VERSION}" ]; then
8487
DOWNLOAD_URL=https://minecraft.azureedge.net/bin-linux/bedrock-server-${VERSION}.zip
8588
fi
8689

87-
TMP_ZIP=/tmp/$(basename "${DOWNLOAD_URL}")
90+
[[ $TMP_DIR != /tmp ]] && mkdir -p "$TMP_DIR"
91+
TMP_ZIP="$TMP_DIR/$(basename "${DOWNLOAD_URL}")"
8892

8993
echo "Downloading Bedrock server version ${VERSION} ..."
9094
if ! curl "${curlArgs[@]}" -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL}; then
@@ -120,7 +124,7 @@ if [ ! -f "bedrock_server-${VERSION}" ]; then
120124
# Do not overwrite existing files, which means the cleanup above needs to account for things
121125
# that MUST be replaced on upgrade
122126
unzip -q -n ${TMP_ZIP}
123-
rm ${TMP_ZIP}
127+
[[ $TMP_DIR != /tmp ]] && rm -rf "$TMP_DIR"
124128

125129
chmod +x bedrock_server
126130
mv bedrock_server bedrock_server-${VERSION}

0 commit comments

Comments
 (0)