mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 06:14:14 +00:00
Fix loading world from compressed tar archives (#1304)
This commit is contained in:
parent
d02bbb798e
commit
8a42dfe232
14 changed files with 60 additions and 10 deletions
|
@ -20,6 +20,7 @@ RUN apt-get update \
|
|||
rsync \
|
||||
nano \
|
||||
unzip \
|
||||
zstd \
|
||||
knockd \
|
||||
ttf-dejavu \
|
||||
&& apt-get clean
|
||||
|
|
|
@ -195,12 +195,16 @@ function extract() {
|
|||
destDir=${2?}
|
||||
|
||||
type=$(file -b --mime-type "${src}")
|
||||
if [[ $type == application/zip ]]; then
|
||||
unzip -q -d "${destDir}" "${src}"
|
||||
elif [[ $type == application/x-tar ]]; then
|
||||
tar -C "${destDir}" -xf "${src}"
|
||||
else
|
||||
log "ERROR: unsupported archive type: $type"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
case "${type}" in
|
||||
application/zip)
|
||||
unzip -q -d "${destDir}" "${src}"
|
||||
;;
|
||||
application/x-tar|application/gzip|application/x-bzip2|application/zstd)
|
||||
tar -C "${destDir}" -xf "${src}"
|
||||
;;
|
||||
*)
|
||||
log "ERROR: unsupported archive type: $type"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ services:
|
|||
EULA: "TRUE"
|
||||
SETUP_ONLY: "TRUE"
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
WORLD: /worlds/world-for-testing.tgz
|
||||
WORLD: /worlds/world-for-testing.tar
|
||||
volumes:
|
||||
- ./worlds:/worlds:ro
|
||||
- ./data:/data
|
14
tests/setuponlytests/world_from_tarbz2/docker-compose.yml
Normal file
14
tests/setuponlytests/world_from_tarbz2/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
restart: "no"
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
SETUP_ONLY: "TRUE"
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
WORLD: /worlds/world-for-testing.tar.bz2
|
||||
volumes:
|
||||
- ./worlds:/worlds:ro
|
||||
- ./data:/data
|
1
tests/setuponlytests/world_from_tarbz2/verify.sh
Normal file
1
tests/setuponlytests/world_from_tarbz2/verify.sh
Normal file
|
@ -0,0 +1 @@
|
|||
mc-image-helper assert fileExists world/level.dat
|
Binary file not shown.
14
tests/setuponlytests/world_from_targz/docker-compose.yml
Normal file
14
tests/setuponlytests/world_from_targz/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
restart: "no"
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
SETUP_ONLY: "TRUE"
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
WORLD: /worlds/world-for-testing.tar.gz
|
||||
volumes:
|
||||
- ./worlds:/worlds:ro
|
||||
- ./data:/data
|
1
tests/setuponlytests/world_from_targz/verify.sh
Normal file
1
tests/setuponlytests/world_from_targz/verify.sh
Normal file
|
@ -0,0 +1 @@
|
|||
mc-image-helper assert fileExists world/level.dat
|
Binary file not shown.
14
tests/setuponlytests/world_from_tarzst/docker-compose.yml
Normal file
14
tests/setuponlytests/world_from_tarzst/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
restart: "no"
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
SETUP_ONLY: "TRUE"
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
WORLD: /worlds/world-for-testing.tar.zst
|
||||
volumes:
|
||||
- ./worlds:/worlds:ro
|
||||
- ./data:/data
|
1
tests/setuponlytests/world_from_tarzst/verify.sh
Normal file
1
tests/setuponlytests/world_from_tarzst/verify.sh
Normal file
|
@ -0,0 +1 @@
|
|||
mc-image-helper assert fileExists world/level.dat
|
Binary file not shown.
Loading…
Reference in a new issue