Skip to content

Use /data/tmp for WORLD zip preparation #3322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions scripts/start-setupWorld
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );

if isURL "$WORLD"; then
log "Downloading world from $WORLD"
if ! get -o /tmp/world.bin "$WORLD"; then
mkdir -p /data/tmp
if ! get -o /data/tmp/world.bin "$WORLD"; then
Copy link
Contributor

@MaxLevs MaxLevs Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like it will be more convenient to have a single variable for a path to world.bin

We can use something like

RAW_WORLD_DATA_PATH="/data/tmp/world.bin"

and then

mkdir -p "$(basedir "$RAW_WORLD_DATA_PATH")"
if ! get -o "$RAW_WORLD_DATA_PATH" "$WORLD"; then
# and so on

logError "Failed to download world from $WORLD"
exit 1
fi
WORLD=/tmp/world.bin
WORLD=/data/tmp/world.bin
fi

if [ -f "$WORLD" ]; then
log "Extracting world"

# Stage contents so that the correct subdirectory can be picked off
mkdir -p /tmp/world-data
if ! extract "$WORLD" /tmp/world-data; then
mkdir -p /data/tmp/world-data
if ! extract "$WORLD" /data/tmp/world-data; then
logError "Extracting world from $WORLD"
exit 1
fi

baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
baseDirs=$(find /data/tmp/world-data -name "level.dat" -exec dirname "{}" \;)

if ! [[ $baseDirs ]]; then
logError "World content is not valid since level.dat could not be found"
Expand Down
Loading