From cf68446a00540c2120bfeb8dcedf633ff9966cb5 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 19 May 2017 20:44:59 -0500 Subject: [PATCH 1/3] Add option to download FTB server zip --- minecraft-server/start-minecraft.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index ac990468..fe95930c 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -18,6 +18,7 @@ if [ ! -e /data/eula.txt ]; then fi fi +SERVER_PROPERTIES=/data/server.properties VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json echo "Checking version information." @@ -173,6 +174,16 @@ function installForge { fi } +function isURL { + local value=$1 + + if [[ ${value:0:8} == "https://" || ${value:0:7} = "http://"]]; + return 0 + else + return 1 + fi +} + function installFTB { TYPE=FEED-THE-BEAST @@ -184,6 +195,11 @@ function installFTB { exit 2 fi local srv_modpack=${FTB_SERVER_MOD} + if [[ isURL ${srv_modpack} ]]; then + local file=$(basename $srv_modpack) + wget -q -O /data/$file + srv_modpack=/data/$file + fi if [[ ${srv_modpack:0:5} == "data/" ]]; then # Prepend with "/" srv_modpack=/${srv_modpack} @@ -211,6 +227,7 @@ function installFTB { FTB_SERVER_START=ServerStart.sh chmod a+x ${FTB_SERVER_START} sed -i "s/-jar/-Dfml.queryResult=confirm -jar/" ${FTB_SERVER_START} + SERVER_PROPERTIES=${ftb_dir}/server.properties } function installVanilla { @@ -442,7 +459,7 @@ if [ ! -e server.properties ]; then ;; esac - sed -i "/gamemode\s*=/ c gamemode=$MODE" /data/server.properties + sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES fi fi From bd8e0cf5d24976127c0e21fab618c7d319f03103 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 May 2017 10:56:32 -0500 Subject: [PATCH 2/3] Fix FTB download and copy adjusted properties into FTB dir --- minecraft-server/start-minecraft.sh | 34 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index fe95930c..7101453d 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -19,6 +19,7 @@ if [ ! -e /data/eula.txt ]; then fi SERVER_PROPERTIES=/data/server.properties +FTB_DIR=/data/FeedTheBeast VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json echo "Checking version information." @@ -177,7 +178,7 @@ function installForge { function isURL { local value=$1 - if [[ ${value:0:8} == "https://" || ${value:0:7} = "http://"]]; + if [[ ${value:0:8} == "https://" || ${value:0:7} = "http://" ]]; then return 0 else return 1 @@ -195,10 +196,19 @@ function installFTB { exit 2 fi local srv_modpack=${FTB_SERVER_MOD} - if [[ isURL ${srv_modpack} ]]; then - local file=$(basename $srv_modpack) - wget -q -O /data/$file - srv_modpack=/data/$file + if isURL ${srv_modpack}; then + case $srv_modpack in + */download) + break;; + *) + srv_modpack=${srv_modpack}/download;; + esac + local file=$(basename $(dirname $srv_modpack)) + local downloaded=/data/${file}.zip + echo "Downloading FTB modpack... + $srv_modpack -> $downloaded" + curl -sSL -o $downloaded $srv_modpack + srv_modpack=$downloaded fi if [[ ${srv_modpack:0:5} == "data/" ]]; then # Prepend with "/" @@ -219,15 +229,12 @@ function installFTB { fi echo "Unpacking FTB server modpack ${srv_modpack} ..." - local ftb_dir=/data/FeedTheBeast - mkdir -p ${ftb_dir} - unzip -o ${srv_modpack} -d ${ftb_dir} - cp -f /data/eula.txt ${ftb_dir}/eula.txt - cd ${ftb_dir} - FTB_SERVER_START=ServerStart.sh + mkdir -p ${FTB_DIR} + unzip -o ${srv_modpack} -d ${FTB_DIR} + cp -f /data/eula.txt ${FTB_DIR}/eula.txt + FTB_SERVER_START=${FTB_DIR}/ServerStart.sh chmod a+x ${FTB_SERVER_START} sed -i "s/-jar/-Dfml.queryResult=confirm -jar/" ${FTB_SERVER_START} - SERVER_PROPERTIES=${ftb_dir}/server.properties } function installVanilla { @@ -532,6 +539,9 @@ JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS} set -x if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then + cp -f $SERVER_PROPERTIES ${FTB_DIR}/server.properties + cp -f /data/eula.txt ${FTB_DIR}/eula.txt + cd ${FTB_DIR} echo "Running FTB server modpack start ..." exec sh ${FTB_SERVER_START} else From 0876ef770457f9bff0182ba5ae91fc726589ccde Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 26 May 2017 20:07:26 -0500 Subject: [PATCH 3/3] Copy additional meta files into FTB directory --- minecraft-server/README.md | 7 +++++++ minecraft-server/start-minecraft.sh | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 577f0787..fcdc04f8 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -307,6 +307,13 @@ Now you can add a `-e FTB_SERVER_MOD=name_of_modpack.zip` to your command-line. -e FTB_SERVER_MOD=FTBPresentsSkyfactory3Server_3.0.6.zip \ -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server +Instead of explicitly downloading a modpack from the Feed the Beast site, you +can you set `FTB_SERVER_MOD` to the **server** URL of a modpack, such as + + $ docker run ... \ + -e TYPE=FTB \ + -e FTB_SERVER_MOD=https://www.feed-the-beast.com/projects/ftb-infinity-lite-1-10/files/2402889 + ### Using the /data volume You must use a persistent `/data` mount for this type of server. diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index 7101453d..5c4c4bc9 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -230,7 +230,7 @@ function installFTB { echo "Unpacking FTB server modpack ${srv_modpack} ..." mkdir -p ${FTB_DIR} - unzip -o ${srv_modpack} -d ${FTB_DIR} + unzip -o ${srv_modpack} -d ${FTB_DIR} cp -f /data/eula.txt ${FTB_DIR}/eula.txt FTB_SERVER_START=${FTB_DIR}/ServerStart.sh chmod a+x ${FTB_SERVER_START} @@ -540,7 +540,7 @@ JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS} set -x if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then cp -f $SERVER_PROPERTIES ${FTB_DIR}/server.properties - cp -f /data/eula.txt ${FTB_DIR}/eula.txt + cp -f /data/{eula,ops,white-list}.txt ${FTB_DIR}/ cd ${FTB_DIR} echo "Running FTB server modpack start ..." exec sh ${FTB_SERVER_START}