mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 13:52:27 +00:00
Support local paths for modpacks / mods (#858)
This commit is contained in:
parent
74072847ca
commit
3854526389
2 changed files with 28 additions and 17 deletions
|
@ -1123,7 +1123,7 @@ The world will only be downloaded or copied if it doesn't exist already. Set `FO
|
|||
|
||||
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
|
||||
|
||||
Like the `WORLD` option above, you can specify the URL of a "mod pack"
|
||||
Like the `WORLD` option above, you can specify the URL or path of a "mod pack"
|
||||
to download and install into `mods` for Forge or `plugins` for Bukkit/Spigot.
|
||||
To use this option pass the environment variable `MODPACK`, such as
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ To use this option pass the environment variable `MODPACK`, such as
|
|||
top level of the zip archive. Make sure the jars are compatible with the
|
||||
particular `TYPE` of server you are running.
|
||||
|
||||
You may also download individual mods using the `MODS` environment variable and supplying the URL
|
||||
You may also download individual mods using the `MODS` environment variable and supplying the URL or path
|
||||
to the jar files. Multiple mods/plugins should be comma separated.
|
||||
|
||||
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,https://www.example.com/mods/mod2.jar ...
|
||||
|
|
|
@ -36,24 +36,28 @@ if [[ "$MODPACK" ]]; then
|
|||
log "ERROR: failed to download from $downloadUrl"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$TYPE" = "SPIGOT" ]; then
|
||||
mkdir -p /data/plugins
|
||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||
fi
|
||||
else
|
||||
mkdir -p /data/mods
|
||||
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||
fi
|
||||
elif [[ "$MODPACK" =~ .*\.zip ]]; then
|
||||
if ! cp $MODPACK /tmp/modpack.zip; then
|
||||
log "ERROR: failed to copy from $MODPACK"
|
||||
exit 2
|
||||
fi
|
||||
rm -f /tmp/modpack.zip
|
||||
|
||||
else
|
||||
log "ERROR Invalid URL given for MODPACK: $MODPACK"
|
||||
log "ERROR Invalid URL or Path given for MODPACK: $MODPACK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$TYPE" = "SPIGOT" ]; then
|
||||
mkdir -p /data/plugins
|
||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||
fi
|
||||
else
|
||||
mkdir -p /data/mods
|
||||
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
||||
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||
fi
|
||||
fi
|
||||
rm -f /tmp/modpack.zip
|
||||
fi
|
||||
|
||||
# If supplied with a URL for a plugin download it.
|
||||
|
@ -87,8 +91,15 @@ if [[ "$MODS" ]]; then
|
|||
exit 2
|
||||
fi
|
||||
fi
|
||||
elif [[ "$i" =~ .*\.jar ]]; then
|
||||
log "Copying plugin located at $i ..."
|
||||
out_file=$(basename "$i")
|
||||
if ! cp "$i" "${out_dir}/$out_file"; then
|
||||
log "ERROR: failed to copy from $i into $out_dir"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
log "ERROR Invalid URL given in MODS: $i"
|
||||
log "ERROR Invalid URL or Path given in MODS: $i"
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue