mc: handle FTB style start script within CurseForge subdirs

mc: upgrade mc-server-runner to launch start scripts via bash
This commit is contained in:
Geoff Bourne 2018-08-12 17:25:16 -05:00
parent 7005f00df0
commit d9c2f26506
5 changed files with 44 additions and 24 deletions

View file

@ -28,7 +28,7 @@ EXPOSE 25565 25575
ARG RESTIFY_VER=1.1.4
ARG RCON_CLI_VER=1.4.0
ARG MC_SERVER_RUNNER_VER=1.1.2
ARG MC_SERVER_RUNNER_VER=1.2.0
ARG ARCH=amd64
ADD https://github.com/itzg/restify/releases/download/${RESTIFY_VER}/restify_${RESTIFY_VER}_linux_${ARCH}.tar.gz /tmp/restify.tgz

View file

@ -0,0 +1,11 @@
version: '3.2'
services:
mc:
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: FTB
FTB_SERVER_MOD: https://minecraft.curseforge.com/projects/all-the-mods-expert-remastered/files/2493900/download
ports:
- 25565:25565

View file

@ -24,7 +24,7 @@ if [ ! -e /data/eula.txt ]; then
fi
fi
echo "Running as '$(id -u):$(id -g)' with /data as '$(ls -lnd /data)'"
echo "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if ! touch /data/.verify_access; then
echo "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=$(id -u)"
@ -61,37 +61,37 @@ esac
cd /data
export ORIGINAL_TYPE=${TYPE}
export ORIGINAL_TYPE=${TYPE^^}
echo "Checking type information."
case "$TYPE" in
*BUKKIT|*bukkit|SPIGOT|spigot)
case "${TYPE^^}" in
*BUKKIT|SPIGOT)
exec /start-deployBukkitSpigot $@
;;
PAPER|paper)
PAPER)
exec /start-deployPaper $@
;;
FORGE|forge)
FORGE)
exec /start-deployForge $@
;;
FTB|ftb)
FTB|CURSEFORGE)
exec /start-deployFTB $@
;;
VANILLA|vanilla)
VANILLA)
exec /start-deployVanilla $@
;;
SPONGEVANILLA|spongevanilla)
SPONGEVANILLA)
exec /start-deploySpongeVanilla $@
;;
*)
echo "Invalid type: '$TYPE'"
echo "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, SPONGEVANILLA"
echo "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA"
exit 1
;;

View file

@ -2,9 +2,8 @@
. /start-utils
export FTB_DIR=/data/FeedTheBeast
export FTB_BASE_DIR=/data/FeedTheBeast
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
legacyJavaFixerPath=${FTB_DIR}/mods/legacyjavafixer.jar
export TYPE=FEED-THE-BEAST
echo "Looking for Feed-The-Beast server modpack."
@ -15,11 +14,20 @@ if [[ -z $FTB_SERVER_MOD ]]; then
exit 2
fi
if [[ -d ${FTB_BASE_DIR} ]]; then
startScriptCount=$(find ${FTB_BASE_DIR} -name ServerStart.sh |wc -l)
if [[ $startScriptCount > 1 ]]; then
echo "Conflicting FTB/CurseForge packages have been installed. Please cleanup ${FTB_BASE_DIR}"
exit 2
fi
else
startScriptCount=0
fi
# only download and install if a mod pack isn't already installed
# also check for the start script rather than just the folder
# this allows saving just the world separate from the rest of the data directory
export FTB_SERVER_START=${FTB_DIR}/ServerStart.sh
if [ ! -f ${FTB_SERVER_START} ]; then
if [[ $startScriptCount = 0 ]]; then
srv_modpack=${FTB_SERVER_MOD}
if isURL ${srv_modpack}; then
case $srv_modpack in
@ -56,13 +64,16 @@ if [ ! -f ${FTB_SERVER_START} ]; then
fi
echo "Unpacking FTB server modpack ${srv_modpack} ..."
mkdir -p ${FTB_DIR}
unzip -o ${srv_modpack} -d ${FTB_DIR} | awk '{printf "."} END {print ""}'
cp -f /data/eula.txt ${FTB_DIR}/eula.txt
mkdir -p ${FTB_BASE_DIR}
unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
fi
chmod a+x ${FTB_SERVER_START}
sed -i "s/-jar/-Dfml.queryResult=confirm -jar/" ${FTB_SERVER_START}
export FTB_SERVER_START=./ServerStart.sh
export FTB_DIR=$(dirname $(find ${FTB_DIR} -name ServerStart.sh))
chmod a+x ${FTB_DIR}/${FTB_SERVER_START}
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' ${FTB_DIR}/${FTB_SERVER_START}
sed -i 's/.*read.*Restart now/#\0/' ${FTB_DIR}/${FTB_SERVER_START}
legacyJavaFixerPath=${FTB_DIR}/mods/legacyjavafixer.jar
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e ${legacyJavaFixerPath} ]; then
echo "Installing legacy java fixer to ${legacyJavaFixerPath}"

View file

@ -84,9 +84,7 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
cp -f /data/white-list.txt ${FTB_DIR}/
fi
if [ ! -e ${FTB_DIR}/eula.txt ]; then
cp -f /data/eula.txt ${FTB_DIR}/
fi
cp -f /data/eula.txt ${FTB_DIR}/
cat > ${FTB_DIR}/settings-local.sh <<EOF
export MIN_RAM="${INIT_MEMORY}"
@ -94,7 +92,7 @@ export MAX_RAM="${MAX_MEMORY}"
EOF
cd ${FTB_DIR}
echo "Running FTB server modpack start ..."
echo "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
exec mc-server-runner ${FTB_SERVER_START}
else
# If we have a bootstrap.txt file... feed that in to the server stdin