Compare commits

..

17 Commits

Author SHA1 Message Date
Geoff Bourne 50c22ac469 Auto-merging via docker-versions-create 2020-08-09 13:07:31 -05:00
Geoff Bourne 81e1cd8cfd Auto-merging via docker-versions-create 2020-07-26 08:30:21 -05:00
Geoff Bourne 8387e9bd26 Auto-merging via docker-versions-create 2020-07-18 18:40:48 -05:00
Geoff Bourne 4afdb289c0 Auto-merging via docker-versions-create 2020-07-11 13:13:48 -05:00
Geoff Bourne fe637353d8 Auto-merging via docker-versions-create 2020-07-10 17:11:51 -05:00
Geoff Bourne 9160501f0a Auto-merging via docker-versions-create 2020-07-04 14:58:15 -05:00
Geoff Bourne 6eba5062ec Auto-merging via docker-versions-create 2020-06-20 15:45:09 -05:00
Geoff Bourne fc96723db1 Auto-merging via docker-versions-create 2020-06-19 13:27:05 -05:00
Geoff Bourne 8d3e461b4c Auto-merging via docker-versions-create 2020-05-20 08:15:12 -05:00
Geoff Bourne fd73417411 Auto-merging via docker-versions-create 2020-05-02 09:34:30 -05:00
Geoff Bourne 1207b9a685 Auto-merging via docker-versions-create 2020-04-25 12:11:09 -05:00
Geoff Bourne e6259bfd9d Auto-merging via docker-versions-create 2020-04-17 21:29:12 -05:00
Geoff Bourne b5e7b952e4 Auto-merging via docker-versions-create 2020-04-11 08:51:52 -05:00
Geoff Bourne ac5b960182 Auto-merging via docker-versions-create 2020-04-10 11:08:59 -05:00
Geoff Bourne 3299dec733 Auto-merging via docker-versions-create 2020-04-03 13:31:44 -05:00
Geoff Bourne 578f06087f Changed JVM_XX_OPTS to use default GC 2020-03-13 10:55:19 -05:00
Geoff Bourne fb364e8301 Prepared adopt13 branch 2020-03-02 21:08:22 -06:00
14 changed files with 174 additions and 290 deletions
-2
View File
@@ -1,4 +1,2 @@
[start-*] [start-*]
indent_size = 2 indent_size = 2
indent_style = space
end_of_line = lf
-4
View File
@@ -8,16 +8,12 @@ on:
- openj9-nightly - openj9-nightly
- adopt11 - adopt11
- adopt13 - adopt13
- adopt14
- adopt15
tags: tags:
- "[0-9]+.[0-9]+.[0-9]+" - "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-openj9" - "[0-9]+.[0-9]+.[0-9]+-openj9"
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly" - "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
- "[0-9]+.[0-9]+.[0-9]+-adopt11" - "[0-9]+.[0-9]+.[0-9]+-adopt11"
- "[0-9]+.[0-9]+.[0-9]+-adopt13" - "[0-9]+.[0-9]+.[0-9]+-adopt13"
- "[0-9]+.[0-9]+.[0-9]+-adopt14"
- "[0-9]+.[0-9]+.[0-9]+-adopt15"
jobs: jobs:
test: test:
+3 -3
View File
@@ -1,4 +1,4 @@
FROM openjdk:8u212-jre-alpine FROM adoptopenjdk/openjdk13:alpine-jre
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>" LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
@@ -55,7 +55,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.5.0 --var app=mc-server-runner --file {{.app}} \ --var version=1.4.3 --var app=mc-server-runner --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
@@ -70,7 +70,7 @@ COPY log4j2.xml /tmp/log4j2.xml
WORKDIR /data WORKDIR /data
ENV UID=1000 GID=1000 \ ENV UID=1000 GID=1000 \
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \ MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \ LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
+22 -37
View File
@@ -1,7 +1,7 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Pulls](https://img.shields.io/docker/pulls/itzg/minecraft-server.svg)](https://hub.docker.com/r/itzg/minecraft-server/)
[![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/) [![Docker Stars](https://img.shields.io/docker/stars/itzg/minecraft-server.svg?maxAge=2592000)](https://hub.docker.com/r/itzg/minecraft-server/)
[![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues) [![GitHub Issues](https://img.shields.io/github/issues-raw/itzg/docker-minecraft-server.svg)](https://github.com/itzg/docker-minecraft-server/issues)
[![Discord](https://img.shields.io/discord/660567679458869252?label=Discord&logo=discord)](https://discord.gg/DXfKpjB) [![Discord](https://img.shields.io/discord/660567679458869252)](https://discord.gg/DXfKpjB)
[![Build and Publish](https://github.com/itzg/docker-minecraft-server/workflows/Build%20and%20Publish/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions) [![Build and Publish](https://github.com/itzg/docker-minecraft-server/workflows/Build%20and%20Publish/badge.svg)](https://github.com/itzg/docker-minecraft-server/actions)
[![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg) [![](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-orange.svg)](https://www.buymeacoffee.com/itzg)
@@ -147,7 +147,6 @@ To use a different version of Java, please use a docker tag to run your Minecraf
| Tag name | Description | Linux | | Tag name | Description | Linux |
| -------------- | ------------------------------------------- | ------------ | | -------------- | ------------------------------------------- | ------------ |
| latest | **Default**. Uses Java version 8 update 212 | Alpine Linux | | latest | **Default**. Uses Java version 8 update 212 | Alpine Linux |
| adopt14 | Uses Java version 14 latest update | Alpine Linux |
| adopt13 | Uses Java version 13 latest update | Alpine Linux | | adopt13 | Uses Java version 13 latest update | Alpine Linux |
| adopt11 | Uses Java version 11 latest update | Alpine Linux | | adopt11 | Uses Java version 11 latest update | Alpine Linux |
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux | | openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
@@ -227,10 +226,6 @@ describes period of the daemonized state machine, that handles the pausing of th
The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image. The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.
### Amazon Web Services (AWS) Deployment
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
## Running a Forge Server ## Running a Forge Server
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line. Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
@@ -301,17 +296,13 @@ or downloading a world with the `WORLD` option.
There are two additional volumes that can be mounted; `/mods` and `/config`. There are two additional volumes that can be mounted; `/mods` and `/config`.
Any files in either of these filesystems will be copied over to the main Any files in either of these filesystems will be copied over to the main
`/data` filesystem before starting Minecraft. If you want old mods to be removed as the `/mods` content is updated, then add `-e REMOVE_OLD_MODS=TRUE`. If you are running a `BUKKIT` distribution this will affect all files inside the `plugins/` directory. You can fine tune the removal process by specifing the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables. By default everything will be removed. You can also specify the `REMOVE_OLD_MODS_DEPTH` (default 16) variable to only delete files up to a certain level. `/data` filesystem before starting Minecraft.
> For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
This works well if you want to have a common set of modules in a separate This works well if you want to have a common set of modules in a separate
location, but still have multiple worlds with different server requirements location, but still have multiple worlds with different server requirements
in either persistent volumes or a downloadable archive. in either persistent volumes or a downloadable archive.
You can specify the destination of the configs that are located inside the `/config` mount by setting the `COPY_CONFIG_DEST` variable. The configs are copied recursivly to the `/data/config` directory by default. If a file was updated directly inside the `/data/*` directoy and is newer than the file in the `/config/*` mount it will not be overriden.
> For example: `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over your `bukkit.yml` and so on directly into the server directory.
### Replacing variables inside configs ### Replacing variables inside configs
@@ -430,9 +421,9 @@ You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up. If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up.
## Running a Paper server ## Running a PaperSpigot server
Enable Paper server mode by adding a `-e TYPE=PAPER` to your command-line. Enable PaperSpigot server mode by adding a `-e TYPE=PAPER` to your command-line.
By default the container will run the latest build of [Paper server](https://papermc.io/downloads) By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
but you can also choose to run a specific build with `-e PAPERBUILD=205`. but you can also choose to run a specific build with `-e PAPERBUILD=205`.
@@ -441,7 +432,7 @@ but you can also choose to run a specific build with `-e PAPERBUILD=205`.
-e TYPE=PAPER \ -e TYPE=PAPER \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
If you are hosting your own copy of Paper you can override the download URL with: If you are hosting your own copy of PaperSpigot you can override the download URL with:
- -e PAPER_DOWNLOAD_URL=<url> - -e PAPER_DOWNLOAD_URL=<url>
@@ -491,7 +482,7 @@ A [Catserver](http://catserver.moe/) type server can be used with
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified. [Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
### Environment Variables: ### Environment Variables:
- `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by [finding the modpack](https://www.feed-the-beast.com/modpack) and using the "ID" displayed next to the name - `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by finding the modpack at [Neptune FTB](https://ftb.neptunepowered.org/) and using the "Pack ID"
- `FTB_MODPACK_VERSION_ID`: optional, the numerical Id of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by drilling into the Versions tab and clicking a specific version. - `FTB_MODPACK_VERSION_ID`: optional, the numerical Id of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by drilling into the Versions tab and clicking a specific version.
### Upgrading ### Upgrading
@@ -566,31 +557,29 @@ Just change it with `SPONGEBRANCH`, such as:
## Running a Fabric Server ## Running a Fabric Server
Enable [Fabric server](http://fabricmc.net/use/) mode by adding a `-e TYPE=FABRIC` to your command-line. By default, the container will run the latest version, but you can also choose to run a specific version with `VERSION`. Enable Fabric server mode by adding a `-e TYPE=FABRIC` to your command-line.
By default the container will run the latest version of [Fabric server](http://fabricmc.net/use/)
but you can also choose to run a specific version with `-e FABRICVERSION=0.5.0.32`.
``` $ docker run -d -v /path/on/host:/data \
docker run -d -v /path/on/host:/data \ -e TYPE=FABRIC -e FABRICVERSION=0.5.0.32 \
-e TYPE=FABRIC \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
A specific installer version can be requested using `FABRIC_INSTALLER_VERSION`. To use a pre-downloaded Fabric installer, place it in the attached `/data` directory and
specify the name of the installer file with `FABRIC_INSTALLER`, such as:
To use a pre-downloaded Fabric installer, place it in a directory attached into the container, such as the `/data` volume and specify the name of the installer file with `FABRIC_INSTALLER`, such as: $ docker run -d -v /path/on/host:/data ... \
-e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ...
``` To download a Fabric installer from a custom location, such as your own file repository, specify
docker run -d -v /path/on/host:/data ... \ the URL with `FABRIC_INSTALLER_URL`, such as:
-e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ...
```
To download a Fabric installer from a custom location, such as your own file repository, specify the URL with `FABRIC_INSTALLER_URL`, such as: $ docker run -d -v /path/on/host:/data ... \
-e FORGE_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ...
``` In both of the cases above, there is no need for the `VERSION` or `FABRICVERSION` variables.
docker run -d -v /path/on/host:/data ... \
-e FABRIC_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ...
```
In order to add mods, you have two options: In order to add mods, you have two options.
### Using the /data volume ### Using the /data volume
@@ -1115,10 +1104,6 @@ Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed whe
Some older servers get confused and think that the GUI interface is enabled. You can explicitly Some older servers get confused and think that the GUI interface is enabled. You can explicitly
disable that by passing `-e GUI=FALSE`. disable that by passing `-e GUI=FALSE`.
### Stop Duration
When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By defaul it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds.
## Running on RaspberryPi ## Running on RaspberryPi
To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#set -x #set -x
# Use this variable to indicate a list of branches that docker hub is watching # Use this variable to indicate a list of branches that docker hub is watching
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'adopt15' 'multiarch' 'multiarch-latest') branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'multiarch')
function TrapExit { function TrapExit {
echo "Checking out back in master" echo "Checking out back in master"
+2 -2
View File
@@ -13,7 +13,7 @@ rcon_client_exists() {
} }
mc_server_listening() { mc_server_listening() {
[[ -n $(netstat -tln | grep -e "0.0.0.0:$SERVER_PORT" -e ":::$SERVER_PORT" | grep LISTEN) ]] [[ -n $(netstat -tln | grep "0.0.0.0:$SERVER_PORT" | grep LISTEN) ]]
} }
java_clients_connected() { java_clients_connected() {
@@ -29,7 +29,7 @@ java_clients_connected() {
# remember, that the host network mode does not work with autopause because of the knockd utility # remember, that the host network mode does not work with autopause because of the knockd utility
for (( i=0; i<${#connections[@]}; i++ )) for (( i=0; i<${#connections[@]}; i++ ))
do do
if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$ ]] ; then if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^\s*127\.0\.0\.1:.*$ ]] ; then
# not localhost # not localhost
return 0 return 0
fi fi
+11 -29
View File
@@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
isDebugging && set -x
set -e set -e
@@ -59,24 +58,16 @@ function downloadSpigot {
;; ;;
esac esac
if [[ ${VERSION^^} = LATEST ]]; then
VANILLA_VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]')
fi
if [[ -z $downloadUrl ]]; then if [[ -z $downloadUrl ]]; then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar" downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
fi fi
setServerVar
if [ -f $SERVER ]; then if [ -f $SERVER ]; then
# tell curl to only download when newer # tell curl to only download when newer
curlArgs="-z $SERVER" zarg="-z $SERVER"
fi
if isDebugging; then
curlArgs="$curlArgs -v"
fi fi
log "Downloading $match from $downloadUrl ..." log "Downloading $match from $downloadUrl ..."
curl -fsSL -o $SERVER $curlArgs "$downloadUrl" curl -fsSL -o $SERVER $zarg "$downloadUrl"
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
cat <<EOF cat <<EOF
@@ -85,13 +76,6 @@ ERROR: failed to download from $downloadUrl
exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-LATEST exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-LATEST
EOF EOF
if isDebugging && [[ $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
cat $SERVER
fi
# remove invalid download
rm $SERVER
exit 3 exit 3
fi fi
@@ -99,19 +83,17 @@ EOF
export JVM_OPTS export JVM_OPTS
} }
function setServerVar {
case "$TYPE" in case "$TYPE" in
*BUKKIT|*bukkit) *BUKKIT|*bukkit)
export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar
;; ;;
*) *)
export SERVER=spigot_server-${VANILLA_VERSION}.jar export SERVER=spigot_server-${VANILLA_VERSION}.jar
;; ;;
esac esac
}
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
setServerVar
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
buildSpigotFromSource buildSpigotFromSource
fi fi
+21 -25
View File
@@ -3,10 +3,9 @@
set -e set -e
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
isDebugging && set -x
export FTB_BASE_DIR=/data/FeedTheBeast export FTB_BASE_DIR=/data/FeedTheBeast
legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
export TYPE=FEED-THE-BEAST export TYPE=FEED-THE-BEAST
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD} FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
@@ -15,7 +14,7 @@ log "Looking for Feed-The-Beast / CurseForge server modpack."
requireVar FTB_SERVER_MOD requireVar FTB_SERVER_MOD
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
if ! [ -f "${FTB_SERVER_MOD}" ]; then if ! [ -f ${FTB_SERVER_MOD} ]; then
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}" log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
exit 2 exit 2
fi fi
@@ -28,7 +27,7 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar") serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
if [[ "${serverJar}" ]]; then if [[ "${serverJar}" ]]; then
rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts,config} rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts}
fi fi
else else
needsInstall=false needsInstall=false
@@ -38,25 +37,22 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
if $needsInstall; then if $needsInstall; then
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..." log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
mkdir -p ${FTB_BASE_DIR} mkdir -p ${FTB_BASE_DIR}
unzip -o "${FTB_SERVER_MOD}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
serverJar=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar") forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
if [[ -z "$serverJar" ]]; then if [[ -z "${forgeInstallerJar}" ]]; then
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") log "ERROR Unable to find forge installer in modpack."
if [[ -z "${forgeInstallerJar}" ]]; then log " Make sure you downloaded the server files."
log "ERROR Unable to find forge installer in modpack." exit 2
log " Make sure you downloaded the server files."
exit 2
fi
log "Installing forge server"
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename "${forgeInstallerJar}") --installServer) | awk '{printf "."} END {print ""}'
fi fi
log "Installing forge server"
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}'
echo "${FTB_SERVER_MOD}" > $installMarker echo "${FTB_SERVER_MOD}" > $installMarker
fi fi
export SERVER=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar") export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
log "ERROR unable to locate installed forge server jar" log "ERROR unable to locate installed forge server jar"
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar" isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
@@ -93,7 +89,7 @@ fi
# this allows saving just the world separate from the rest of the data directory # this allows saving just the world separate from the rest of the data directory
if [[ $startScriptCount = 0 ]]; then if [[ $startScriptCount = 0 ]]; then
srv_modpack=${FTB_SERVER_MOD} srv_modpack=${FTB_SERVER_MOD}
if isURL "${srv_modpack}"; then if isURL ${srv_modpack}; then
case $srv_modpack in case $srv_modpack in
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file) https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
;; ;;
@@ -111,19 +107,19 @@ if [[ $startScriptCount = 0 ]]; then
fi fi
srv_modpack=$downloaded srv_modpack=$downloaded
fi fi
if [[ "${srv_modpack:0:5}" == "data/" ]]; then if [[ ${srv_modpack:0:5} == "data/" ]]; then
# Prepend with "/" # Prepend with "/"
srv_modpack="/${srv_modpack}" srv_modpack=/${srv_modpack}
fi fi
if [[ ! "${srv_modpack:0:1}" == "/" ]]; then if [[ ! ${srv_modpack:0:1} == "/" ]]; then
# If not an absolute path, assume file is in "/data" # If not an absolute path, assume file is in "/data"
srv_modpack=/data/${srv_modpack} srv_modpack=/data/${srv_modpack}
fi fi
if [[ ! -f "${srv_modpack}" ]]; then if [[ ! -f ${srv_modpack} ]]; then
log "FTB server modpack ${srv_modpack} not found." log "FTB server modpack ${srv_modpack} not found."
exit 2 exit 2
fi fi
if [[ ! "${srv_modpack: -4}" == ".zip" ]]; then if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
log "FTB server modpack ${srv_modpack} is not a zip archive." log "FTB server modpack ${srv_modpack} is not a zip archive."
log "Please set FTB_SERVER_MOD to a file with a .zip extension." log "Please set FTB_SERVER_MOD to a file with a .zip extension."
exit 2 exit 2
@@ -131,7 +127,7 @@ if [[ $startScriptCount = 0 ]]; then
log "Unpacking FTB server modpack ${srv_modpack} ..." log "Unpacking FTB server modpack ${srv_modpack} ..."
mkdir -p ${FTB_BASE_DIR} mkdir -p ${FTB_BASE_DIR}
unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}' unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
fi fi
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
@@ -169,7 +165,7 @@ export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
export FTB_DIR=$(dirname "${FTB_SERVER_START}") export FTB_DIR=$(dirname "${FTB_SERVER_START}")
chmod a+x "${FTB_SERVER_START}" chmod a+x "${FTB_SERVER_START}"
grep fml.queryResult=confirm "${FTB_SERVER_START}" > /dev/null || \ grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}" sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}" sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar" legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
+13 -11
View File
@@ -7,34 +7,36 @@ export TYPE=FABRIC
FABRIC_INSTALLER=${FABRIC_INSTALLER:-} FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-} FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
FABRIC_INSTALLER_VERSION=${FABRIC_INSTALLER_VERSION:-${FABRICVERSION:-LATEST}} FABRICVERSION=${FABRICVERSION:-LATEST}
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
log "Checking Fabric version information." log "Checking Fabric version information."
case $FABRIC_INSTALLER_VERSION in case $FABRICVERSION in
LATEST) LATEST)
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml) FABRIC_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
;;
*)
FABRIC_VERSION=$FABRICVERSION
;; ;;
esac esac
FABRIC_INSTALLER="/tmp/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar" FABRIC_INSTALLER="/tmp/fabric-installer-$FABRIC_VERSION.jar"
markerVersion=$FABRIC_INSTALLER_VERSION
elif [[ -z $FABRIC_INSTALLER ]]; then elif [[ -z $FABRIC_INSTALLER ]]; then
FABRIC_INSTALLER="/tmp/fabric-installer.jar" FABRIC_INSTALLER="/tmp/fabric-installer.jar"
markerVersion=custom
elif [[ ! -e $FABRIC_INSTALLER ]]; then elif [[ ! -e $FABRIC_INSTALLER ]]; then
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER" log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
exit 2 exit 2
fi fi
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${markerVersion}" installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
debug Checking for installMarker ${installMarker} debug Checking for installMarker ${installMarker}
if [[ ! -e $installMarker ]]; then if [[ ! -e $installMarker ]]; then
if [[ ! -e $FABRIC_INSTALLER ]]; then if [[ ! -e $FABRIC_INSTALLER ]]; then
if [[ -z $FABRIC_INSTALLER_URL ]]; then if [[ -z $FABRIC_INSTALLER_URL ]]; then
log "Downloading installer version $FABRIC_INSTALLER_VERSION" log "Downloading $FABRIC_VERSION"
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar" downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/$FABRIC_VERSION/fabric-installer-$FABRIC_VERSION.jar"
log "...trying $downloadUrl" log "...trying $downloadUrl"
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
else else
@@ -47,9 +49,9 @@ if [[ ! -e $installMarker ]]; then
fi fi
if isDebugging; then if isDebugging; then
debug "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER" debug "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER with mcversion ${VANILLA_VERSION}"
else else
log "Installing Fabric using $FABRIC_INSTALLER" log "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER"
fi fi
tries=3 tries=3
set +e set +e
+9 -47
View File
@@ -1,57 +1,19 @@
#!/bin/bash #!/bin/bash
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
set -o pipefail
isDebugging && set -x
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config : ${PAPERBUILD:=latest}
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \ if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
| jq '.builds[-1]') zarg="-z '$SERVER'"
case $? in
0)
;;
22)
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
if [[ $VERSION = LATEST ]]; then
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
# re-execute the current script with the newly computed version
exec $0 "$@"
fi
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
log " Set VERSION to one of the following: "
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
exit 1
;;
*)
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
exit 1
;;
esac
if [ $? != 0 ]; then
echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}"
exit 1
fi fi
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \ downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
| jq -r '.downloads.application.name') log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
if [ $? != 0 ]; then if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl"; then
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}" log "ERROR: failed to download from $downloadUrl (status=$?)"
exit 1 exit 3
fi
if [ -f "$SERVER" ]; then
zarg=(-z "$SERVER")
fi
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
curl -fsSL -o "$SERVER" "${zarg[@]}" \
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
-H "accept: application/java-archive"
if [ $? != 0 ]; then
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
exit 1
fi fi
# Normalize on Spigot for downstream operations # Normalize on Spigot for downstream operations
+39 -37
View File
@@ -1,26 +1,19 @@
#!/bin/bash #!/bin/bash
set -e -o pipefail set -e
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
if isDebugging; then
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}
# Remove old mods/plugins # Remove old mods/plugins
if isTrue ${REMOVE_OLD_MODS}; then if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then
remove_mods_dest="/data/mods" if [ "$TYPE" = "SPIGOT" ]; then
case ${TYPE} in rm -rf /data/plugins/*
SPIGOT|BUKKIT|PAPER) else
remove_mods_dest="/data/plugins" rm -rf /data/mods/*
;; fi
esac
log "Removing old mods in $remove_mods_dest..."
find $remove_mods_dest -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete
fi 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
@@ -29,7 +22,7 @@ if [[ "$MODPACK" ]]; then
if [[ "${MODPACK}" == *.zip ]]; then if [[ "${MODPACK}" == *.zip ]]; then
downloadUrl="${MODPACK}" downloadUrl="${MODPACK}"
else else
downloadUrl=$(curl -Ls -o /dev/null -w %{effective_url} $MODPACK) downloadUrl=$(curl -Ls -o /dev/null -w %{url_effective} $MODPACK)
if ! [[ $downloadUrl == *.zip ]]; then if ! [[ $downloadUrl == *.zip ]]; then
log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK" log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK"
log " Must be HTTP or HTTPS and a ZIP file" log " Must be HTTP or HTTPS and a ZIP file"
@@ -65,31 +58,39 @@ fi
# If supplied with a URL for a plugin download it. # If supplied with a URL for a plugin download it.
if [[ "$MODS" ]]; then if [[ "$MODS" ]]; then
if [ "$TYPE" = "SPIGOT" ]; then
out_dir=/data/plugins
else
out_dir=/data/mods
fi
mkdir -p "$out_dir"
for i in ${MODS//,/ } for i in ${MODS//,/ }
do do
if isURL $i; then if isURL $i; then
log "Downloading mod/plugin $i ..." if [[ $i == *.jar ]]; then
effective_url=$(resolveEffectiveUrl "$i") EFFECTIVE_MOD_URL=$i
if isValidFileURL jar "${effective_url}"; then
out_file=$(getFilenameFromUrl "${effective_url}")
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
log "ERROR: failed to download from $i into $out_dir"
exit 2
fi
else else
log "ERROR: $effective_url resolved from $i is not a valid jar URL" EFFECTIVE_MOD_URL=$(curl -Ls -o /dev/null -w %{url_effective} $i)
if ! [[ $EFFECTIVE_MOD_URL == *.jar ]]; then
log "ERROR Invalid URL given in MODS: $EFFECTIVE_MOD_URL resolved from $i"
log " Must be HTTP or HTTPS and a JAR file"
exit 1
fi
fi
log "Downloading mod/plugin via HTTP"
log " from $EFFECTIVE_MOD_URL ..."
if ! curl -sSL -o /tmp/${EFFECTIVE_MOD_URL##*/} $EFFECTIVE_MOD_URL; then
log "ERROR: failed to download from $EFFECTIVE_MOD_URL to /tmp/${EFFECTIVE_MOD_URL##*/}"
exit 2 exit 2
fi fi
if [ "$TYPE" = "SPIGOT" ]; then
mkdir -p /data/plugins
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/plugins/${EFFECTIVE_MOD_URL##*/}
else
mkdir -p /data/mods
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/mods/${EFFECTIVE_MOD_URL##*/}
fi
rm -f /tmp/${EFFECTIVE_MOD_URL##*/}
else else
log "ERROR Invalid URL given in MODS: $i" log "ERROR Invalid URL given in MODS: $i"
exit 2 exit 1
fi fi
done done
fi fi
@@ -99,7 +100,7 @@ if [[ "$MANIFEST" ]]; then
EFFECTIVE_MANIFEST_FILE=$MANIFEST EFFECTIVE_MANIFEST_FILE=$MANIFEST
elif isURL "$MANIFEST"; then elif isURL "$MANIFEST"; then
EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{effective_url} $MANIFEST) EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{url_effective} $MANIFEST)
curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL" curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL"
else else
log "MANIFEST='$MANIFEST' is not a valid manifest url or location" log "MANIFEST='$MANIFEST' is not a valid manifest url or location"
@@ -120,7 +121,7 @@ case "X$EFFECTIVE_MANIFEST_FILE" in
do do
if [ ! -f $MOD_DIR/${p}_${f}.jar ] if [ ! -f $MOD_DIR/${p}_${f}.jar ]
then then
redirect_url="$(curl -Ls -o /dev/null -w %{effective_url} ${CURSE_URL_BASE}/${p})" redirect_url="$(curl -Ls -o /dev/null -w %{url_effective} ${CURSE_URL_BASE}/${p})"
url="$redirect_url/download/${f}/file" url="$redirect_url/download/${f}/file"
log Downloading curseforge mod $url log Downloading curseforge mod $url
# Manifest usually doesn't have mod names. Using id should be fine, tho # Manifest usually doesn't have mod names. Using id should be fine, tho
@@ -139,9 +140,10 @@ fi
if [[ "${GENERIC_PACK}" ]]; then if [[ "${GENERIC_PACK}" ]]; then
if isURL "${GENERIC_PACK}"; then if isURL "${GENERIC_PACK}"; then
log "Downloading generic pack ..." generic_pack_url=${GENERIC_PACK}
curl -fsSL -o /tmp/generic_pack.zip "${GENERIC_PACK}" GENERIC_PACK=/tmp/$(basename ${generic_pack_url})
GENERIC_PACK=/tmp/generic_pack.zip log "Downloading generic pack from ${generic_pack_url} ..."
curl -fsSL -o ${GENERIC_PACK} ${generic_pack_url}
fi fi
sum_file=/data/.generic_pack.sum sum_file=/data/.generic_pack.sum
+1 -11
View File
@@ -25,12 +25,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
mkdir -p /tmp/world-data mkdir -p /tmp/world-data
(cd /tmp/world-data && unzip -o -q "$zipSrc") (cd /tmp/world-data && unzip -o -q "$zipSrc")
if [ "$TYPE" = "SPIGOT" ]; then baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
baseDirs=$(find /tmp/world-data -name "level.dat" -not -path "*_nether*" -not -path "*_the_end*" -exec dirname "{}" \;)
else
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
fi
count=$(echo "$baseDirs" | wc -l) count=$(echo "$baseDirs" | wc -l)
if [[ $count -gt 1 ]]; then if [[ $count -gt 1 ]]; then
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)" baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
@@ -43,11 +38,6 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
exit 1 exit 1
fi fi
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest" rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
if [ "$TYPE" = "SPIGOT" ]; then
log "Copying end and nether ..."
[ -d "${baseDir}_nether" ] && rsync --remove-source-files --recursive --delete "${baseDir}_nether/" "${worldDest}_nether"
[ -d "${baseDir}_the_end" ] && rsync --remove-source-files --recursive --delete "${baseDir}_the_end/" "${worldDest}_the_end"
fi
else else
log "Cloning world directory from $WORLD ..." log "Cloning world directory from $WORLD ..."
rsync --recursive --delete "${WORLD%/}"/ "$worldDest" rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
+10 -9
View File
@@ -2,8 +2,6 @@
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
: ${COPY_CONFIG_DEST:="/data/config"}
if [ -n "$OPS" ]; then if [ -n "$OPS" ]; then
log "Setting/adding ops" log "Setting/adding ops"
rm -rf /data/ops.txt.converted rm -rf /data/ops.txt.converted
@@ -56,14 +54,17 @@ done
if [ -d /mods ]; then if [ -d /mods ]; then
log "Copying any mods over..." log "Copying any mods over..."
mkdir -p /data/mods mkdir -p /data/mods
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
fi fi
if [ -d /config ]; then [ -d /data/config ] || mkdir /data/config
log "Copying any configs from /config to $COPY_CONFIG_DEST" for c in /config/*
mkdir -p $COPY_CONFIG_DEST do
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST if [ -f "$c" ]; then
fi log Copying configuration $(basename "$c")
cp -rf "$c" /data/config
fi
done
EXTRA_ARGS="" EXTRA_ARGS=""
# Optional disable console # Optional disable console
@@ -172,7 +173,7 @@ function copyFilesForCurseForge() {
cp -f /data/eula.txt "${FTB_DIR}/" cp -f /data/eula.txt "${FTB_DIR}/"
} }
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s" mcServerRunnerArgs="--stop-duration 60s"
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
if isTrue ${DEBUG_EXEC}; then if isTrue ${DEBUG_EXEC}; then
set -x set -x
+40 -70
View File
@@ -1,14 +1,8 @@
#!/bin/bash #!/bin/bash
function join_by() { function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
local d=$1
shift
echo -n "$1"
shift
printf "%s" "${@/#/$d}"
}
function isURL() { function isURL {
local value=$1 local value=$1
if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then
@@ -18,114 +12,90 @@ function isURL() {
fi fi
} }
function isValidFileURL() { function isTrue {
suffix=${1:?Missing required suffix arg}
url=${2:?Missing required url arg}
[[ "$url" == http*://*.${suffix} || "$url" == http*://*.${suffix}\?* ]]
}
function resolveEffectiveUrl() {
url="${1:?Missing required url argument}"
if ! curl -Ls -o /dev/null -w %{url_effective} "$url"; then
log "ERROR failed to resolve effective URL from $url"
exit 2
fi
}
function getFilenameFromUrl() {
url="${1:?Missing required url argument}"
strippedOfQuery="${url%\?*}"
basename "$strippedOfQuery"
}
function isTrue() {
local value=${1,,} local value=${1,,}
result= result=
case ${value} in case ${value} in
true | on) true|on)
result=0 result=0
;; ;;
*) *)
result=1 result=1
;; ;;
esac esac
return ${result} return ${result}
} }
function isDebugging() { function isDebugging {
if [[ -v DEBUG ]] && [[ ${DEBUG^^} == TRUE ]]; then if [[ -v DEBUG ]] && [[ ${DEBUG^^} = TRUE ]]; then
return 0 return 0
else else
return 1 return 1
fi fi
} }
function debug() { function debug {
if isDebugging; then if isDebugging; then
log "DEBUG: $*" log "DEBUG: $*"
fi fi
} }
function logn() { function logn {
echo -n "[init] $*" echo -n "[init] $*"
} }
function log() { function log {
echo "[init] $*" echo "[init] $*"
} }
function logAutopause() { function logAutopause {
echo "[Autopause loop] $*" echo "[Autopause loop] $*"
} }
function logAutopauseAction() { function logAutopauseAction {
echo "[$(date -Iseconds)] [Autopause] $*" echo "[$(date -Iseconds)] [Autopause] $*"
} }
function normalizeMemSize() { function normalizeMemSize {
local scale=1 local scale=1
case ${1,,} in case ${1,,} in
*k) *k)
scale=1024 scale=1024;;
;; *m)
*m) scale=1048576;;
scale=1048576 *g)
;; scale=1073741824;;
*g)
scale=1073741824
;;
esac esac
val=${1:0:-1} val=${1:0: -1}
echo $((val * scale)) echo $(( val * scale ))
} }
function versionLessThan() { function versionLessThan {
local activeParts local activeParts
IFS=. read -ra activeParts <<<"${VANILLA_VERSION}" IFS=. read -ra activeParts <<< "${VANILLA_VERSION}"
local givenParts local givenParts
IFS=. read -ra givenParts <<<"$1" IFS=. read -ra givenParts <<< "$1"
if ((${#activeParts[@]} < 2)); then if (( ${#activeParts[@]} < 2 )); then
return 1 return 1
fi fi
if ((${#activeParts[@]} == 2)); then if (( ${#activeParts[@]} == 2 )); then
if ((activeParts[0] < givenParts[0])) || if (( activeParts[0] < givenParts[0] )) || \
((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])); then (( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
return 0 return 0
else else
return 1 return 1
fi fi
else else
if ((activeParts[0] < givenParts[0])) || if (( activeParts[0] < givenParts[0] )) || \
((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])) || (( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )) || \
((activeParts[0] == givenParts[0] && activeParts[1] == givenParts[1] && activeParts[2] < givenParts[2])); then (( activeParts[0] == givenParts[0] && activeParts[1] == givenParts[1] && activeParts[2] < givenParts[2] )); then
return 0 return 0
else else
return 1 return 1
@@ -145,10 +115,10 @@ requireVar() {
} }
function writeEula() { function writeEula() {
if ! echo "# Generated via Docker on $(date) if ! echo "# Generated via Docker on $(date)
eula=${EULA,,} eula=${EULA,,}
" >/data/eula.txt; then " > /data/eula.txt; then
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}" log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2 exit 2
fi fi
} }