Merge pull request #335 from billimek/force-redownload

add option for force re-download of server file
This commit is contained in:
Geoff Bourne 2019-06-12 22:11:36 -05:00 committed by GitHub
commit a698c4127c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 5 deletions

View file

@ -537,6 +537,20 @@ If it is a URL, it will only be downloaded into the `/data` directory if it wasn
such, if you need to upgrade or re-download the JAR, then you will need to stop the container, such, if you need to upgrade or re-download the JAR, then you will need to stop the container,
remove the file from the container's `/data` directory, and start again. remove the file from the container's `/data` directory, and start again.
## Force re-download of the server file
For VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, CURSEFORGE, SPONGEVANILLA server types, set
`$FORCE_REDOWNLOAD` to some value (e.g. 'true) to force a re-download of the server file for
the particular server type. by adding a `-e FORCE_REDOWNLOAD=true` to your command-line.
For example, with PaperSpigot, it would look something like this:
```
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e VERSION=1.14.1 -e FORCE_REDOWNLOAD=true \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
## Using Docker Compose ## Using Docker Compose
Rather than type the server options below, the port mappings above, etc Rather than type the server options below, the port mappings above, etc

View file

@ -72,7 +72,7 @@ case "$TYPE" in
;; ;;
esac esac
if [ ! -f $SERVER ]; then if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then if [[ "$BUILD_SPIGOT_FROM_SOURCE" = TRUE || "$BUILD_SPIGOT_FROM_SOURCE" = true || "$BUILD_FROM_SOURCE" = TRUE || "$BUILD_FROM_SOURCE" = true ]]; then
buildSpigotFromSource buildSpigotFromSource
else else

View file

@ -6,7 +6,7 @@ if isURL ${CUSTOM_SERVER}; then
filename=$(basename ${CUSTOM_SERVER}) filename=$(basename ${CUSTOM_SERVER})
export SERVER=/data/${filename} export SERVER=/data/${filename}
if [[ -f ${SERVER} ]]; then if [[ -f ${SERVER} ]] || [ -n "$FORCE_REDOWNLOAD" ]; then
echo "Using previously downloaded jar at ${SERVER}" echo "Using previously downloaded jar at ${SERVER}"
else else
echo "Downloading custom server jar from ${CUSTOM_SERVER} ..." echo "Downloading custom server jar from ${CUSTOM_SERVER} ..."

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
export SERVER=paper_server.jar export SERVER=paper_server.jar
if [ ! -f $SERVER ]; then if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download} downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download}
echo "Downloading Paper $VANILLA_VERSION from $downloadUrl ..." echo "Downloading Paper $VANILLA_VERSION from $downloadUrl ..."
curl -fsSL -o $SERVER "$downloadUrl" curl -fsSL -o $SERVER "$downloadUrl"

View file

@ -28,7 +28,7 @@ fi
export SERVER="spongevanilla-$SPONGEVERSION.jar" export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e $SERVER ]; then if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
echo "Downloading $SERVER ..." echo "Downloading $SERVER ..."
curl -sSL -o $SERVER https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER curl -sSL -o $SERVER https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER
fi fi

View file

@ -5,7 +5,7 @@ set -o pipefail
export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar" export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar"
if [ ! -e $SERVER ]; then if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
echo "Downloading $SERVER ..." echo "Downloading $SERVER ..."
debug "Finding version manifest for $VANILLA_VERSION" debug "Finding version manifest for $VANILLA_VERSION"
versionManifestUrl=$(curl -fsSL 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VANILLA_VERSION "$VANILLA_VERSION" --raw-output '[.versions[]|select(.id == $VANILLA_VERSION)][0].url') versionManifestUrl=$(curl -fsSL 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VANILLA_VERSION "$VANILLA_VERSION" --raw-output '[.versions[]|select(.id == $VANILLA_VERSION)][0].url')