mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-05 14:26:24 +00:00
feat: support WORLD files in compressed tar format (#1297)
This commit is contained in:
@@ -188,4 +188,19 @@ function isType() {
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function extract() {
|
||||
src=${1?}
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user