mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Converted MODPACK to use image helper
This commit is contained in:
parent
8bf7c6cccd
commit
043d9778b8
@ -9,9 +9,7 @@ set -e -o pipefail
|
|||||||
|
|
||||||
# shellcheck source=start-utils
|
# shellcheck source=start-utils
|
||||||
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
||||||
if isDebugging; then
|
isDebugging && set -x
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CURSE_URL_BASE used in manifest downloads below
|
# CURSE_URL_BASE used in manifest downloads below
|
||||||
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
||||||
@ -25,25 +23,13 @@ fi
|
|||||||
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
||||||
if [[ "$MODPACK" ]]; then
|
if [[ "$MODPACK" ]]; then
|
||||||
if isURL "${MODPACK}"; then
|
if isURL "${MODPACK}"; then
|
||||||
if [[ "${MODPACK}" == *.zip ]]; then
|
|
||||||
downloadUrl="${MODPACK}"
|
|
||||||
else
|
|
||||||
downloadUrl=$(curl -Ls -o /dev/null -w %{url_effective} $MODPACK)
|
|
||||||
if ! [[ $downloadUrl == *.zip ]]; then
|
|
||||||
log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK"
|
|
||||||
log " Must be HTTP, HTTPS or FTP and a ZIP file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "Downloading mod/plugin pack"
|
log "Downloading mod/plugin pack"
|
||||||
log " from $downloadUrl ..."
|
if ! get -o /tmp/modpack.zip "${MODPACK}"; then
|
||||||
if ! curl -sSL -o /tmp/modpack.zip "$downloadUrl"; then
|
log "ERROR: failed to download from ${MODPACK}"
|
||||||
log "ERROR: failed to download from $downloadUrl"
|
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
elif [[ "$MODPACK" =~ .*\.zip ]]; then
|
elif [[ "$MODPACK" =~ .*\.zip ]]; then
|
||||||
if ! cp $MODPACK /tmp/modpack.zip; then
|
if ! cp "$MODPACK" /tmp/modpack.zip; then
|
||||||
log "ERROR: failed to copy from $MODPACK"
|
log "ERROR: failed to copy from $MODPACK"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@ -55,19 +41,17 @@ if [[ "$MODPACK" ]]; then
|
|||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
mkdir -p /data/plugins
|
mkdir -p /data/plugins
|
||||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
||||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
log "ERROR: failed to unzip the modpack from ${MODPACK}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mkdir -p /data/mods
|
mkdir -p /data/mods
|
||||||
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
||||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
log "ERROR: failed to unzip the modpack from ${MODPACK}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/modpack.zip
|
rm -f /tmp/modpack.zip
|
||||||
fi
|
|
||||||
|
|
||||||
# If supplied with a URL for a plugin download it.
|
elif [[ "$MODS" ]]; then
|
||||||
if [[ "$MODS" ]]; then
|
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
out_dir=/data/plugins
|
out_dir=/data/plugins
|
||||||
else
|
else
|
||||||
@ -98,9 +82,8 @@ if [[ "$MODS" ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$MODS_FILE" ]]; then
|
elif [[ "$MODS_FILE" ]]; then
|
||||||
if [ ! -f "$MODS_FILE" ]; then
|
if [ ! -f "$MODS_FILE" ]; then
|
||||||
log "ERROR: given MODS_FILE file does not exist"
|
log "ERROR: given MODS_FILE file does not exist"
|
||||||
exit 2
|
exit 2
|
||||||
|
Loading…
Reference in New Issue
Block a user