[mc] Adding MODPACK download option similar to WORLD

This commit is contained in:
Geoff Bourne 2016-01-01 12:39:43 -06:00
parent 16b3f18400
commit 9fa27b9a3d
3 changed files with 31 additions and 1 deletions

View file

@ -36,4 +36,4 @@ ENV UID=1000
ENV MOTD A Minecraft Server Powered by Docker
ENV JVM_OPTS -Xmx1024M -Xms1024M
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD=
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK=

View file

@ -301,6 +301,17 @@ will be deleted when the container is deleted.
you should use an IP address or a globally resolveable FQDN, or else the
name of a linked container.
### Downloadable mod pack
Like the `WORLD` option above, you can specify the URL of a "mod pack"
to download and install into the `mods` directory. To use this option
pass the environment variable `MODPACK`, such as
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ...
**NOTE:** The referenced URL must be a zip file with one or more Forge jar files at the
top level of the zip archive.
## JVM Configuration
### Memory Limit

View file

@ -90,6 +90,7 @@ case "$TYPE" in
esac
# If supplied with a URL for a world, download it and unpack
if [[ "$WORLD" ]]; then
case "X$WORLD" in
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
echo "Downloading world via HTTP"
@ -113,6 +114,24 @@ case "X$WORLD" in
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
;;
esac
fi
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
if [[ "$MODPACK" ]]; then
case "X$MODPACK" in
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
echo "Downloading mod pack via HTTP"
echo "$MODPACK"
mkdir -p /data/mods
wget -q -O /tmp/modpack.zip "$MODPACK"
unzip -d /data/mods /tmp/modpack.zip
rm -f /tmp/modpack.zip
;;
*)
echo "Invalid URL given for modpack: Must be HTTP or HTTPS and a ZIP file"
;;
esac
fi
if [ ! -e server.properties ]; then
cp /tmp/server.properties .