mirror of
https://github.com/itzg/docker-minecraft-server
synced 2025-01-06 01:08:42 +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
|
### 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 download and install into `mods` for Forge or `plugins` for Bukkit/Spigot.
|
||||||
To use this option pass the environment variable `MODPACK`, such as
|
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
|
top level of the zip archive. Make sure the jars are compatible with the
|
||||||
particular `TYPE` of server you are running.
|
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.
|
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 ...
|
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"
|
log "ERROR: failed to download from $downloadUrl"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$MODPACK" =~ .*\.zip ]]; then
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if ! cp $MODPACK /tmp/modpack.zip; then
|
||||||
mkdir -p /data/plugins
|
log "ERROR: failed to copy from $MODPACK"
|
||||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
exit 2
|
||||||
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
|
fi
|
||||||
rm -f /tmp/modpack.zip
|
|
||||||
|
|
||||||
else
|
else
|
||||||
log "ERROR Invalid URL given for MODPACK: $MODPACK"
|
log "ERROR Invalid URL or Path given for MODPACK: $MODPACK"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
fi
|
||||||
|
|
||||||
# If supplied with a URL for a plugin download it.
|
# If supplied with a URL for a plugin download it.
|
||||||
|
@ -87,8 +91,15 @@ if [[ "$MODS" ]]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
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
|
else
|
||||||
log "ERROR Invalid URL given in MODS: $i"
|
log "ERROR Invalid URL or Path given in MODS: $i"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue