Skip to content

Commit

Permalink
Default downloads to subdir of /data (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg authored Dec 9, 2024
1 parent ee01883 commit 6091176
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bedrock-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eo pipefail

: "${TMP_DIR:=/tmp}"
: "${DOWNLOAD_DIR:=${PWD}/.downloads}"
: "${PREVIEW:=false}"

function isTrue() {
Expand Down Expand Up @@ -67,7 +67,7 @@ if [[ ${DEBUG^^} == TRUE ]]; then
echo " current directory is $(pwd)"
fi

export HOME=/data
export HOME="${PWD}"

downloadPage=https://www.minecraft.net/en-us/download/server/bedrock

Expand Down Expand Up @@ -104,8 +104,8 @@ esac

if [[ ! -f "bedrock_server-${VERSION}" ]]; then

[[ $TMP_DIR != /tmp ]] && mkdir -p "$TMP_DIR"
TMP_ZIP="$TMP_DIR/$(basename "${DOWNLOAD_URL}")"
[[ $DOWNLOAD_DIR != /tmp ]] && mkdir -p "$DOWNLOAD_DIR"
TMP_ZIP="$DOWNLOAD_DIR/$(basename "${DOWNLOAD_URL}")"

echo "Downloading Bedrock server version ${VERSION} ..."
if ! curl "${curlArgs[@]}" -o "${TMP_ZIP}" -A "itzg/minecraft-bedrock-server" -fsSL "${DOWNLOAD_URL}"; then
Expand Down Expand Up @@ -146,7 +146,7 @@ if [[ ! -f "bedrock_server-${VERSION}" ]]; then
# Do not overwrite existing files, which means the cleanup above needs to account for things
# that MUST be replaced on upgrade
unzip -q -n "${TMP_ZIP}"
[[ $TMP_DIR != /tmp ]] && rm -rf "$TMP_DIR"
[[ $DOWNLOAD_DIR != /tmp ]] && rm -rf "$DOWNLOAD_DIR"

chmod +x bedrock_server
mv bedrock_server "bedrock_server-${VERSION}"
Expand Down

0 comments on commit 6091176

Please sign in to comment.