Skip to content

Commit

Permalink
Ensured eula and other files brought over when not using CF start scr…
Browse files Browse the repository at this point in the history
…ipt (#591)
  • Loading branch information
itzg committed Jul 19, 2020
1 parent beaccbc commit 06cffd9
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions start-minecraftFinalSetup
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,19 @@ fi

JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"

function copyFilesForCurseForge() {
# copy player modification files unconditionally since their
# processing into json is additive anyway
[ -f /data/ops.txt ] && cp -f /data/ops.txt ${FTB_DIR}/
[ -f /data/white-list.txt ] && cp -f /data/white-list.txt ${FTB_DIR}/

if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
cp -f /data/server-icon.png ${FTB_DIR}/
fi

cp -f /data/eula.txt "${FTB_DIR}/"
}

mcServerRunnerArgs="--stop-duration 60s"
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
if isTrue ${DEBUG_EXEC}; then
Expand All @@ -169,43 +182,36 @@ if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
elif [[ ${TYPE} == "FEED-THE-BEAST" && "${SERVER}" ]]; then
copyFilesForCurseForge

cd "${FTB_DIR}"
log "Starting CurseForge server in ${FTB_DIR}..."
if isTrue ${DEBUG_EXEC}; then
set -x
fi
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar $(basename "${SERVER}") "$@" $EXTRA_ARGS
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"

# copy player modification files unconditionally since their
# processing into json is additive anyway
[ -f /data/ops.txt ] && cp -f /data/ops.txt ${FTB_DIR}/
[ -f /data/white-list.txt ] && cp -f /data/white-list.txt ${FTB_DIR}/
copyFilesForCurseForge

if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
cp -f /data/server-icon.png ${FTB_DIR}/
fi

cp -f /data/eula.txt "${FTB_DIR}/"

cat > "${FTB_DIR}/settings-local.sh" <<EOF
cat > "${FTB_DIR}/settings-local.sh" <<EOF
export MIN_RAM="${INIT_MEMORY}"
export MAX_RAM="${MAX_MEMORY}"
export JAVA_PARAMETERS="${JVM_XX_OPTS} -Xms${INIT_MEMORY} ${JVM_OPTS} $expandedDOpts"
EOF

# patch CurseForge cfg file, if present
if [ -f "${FTB_DIR}/settings.cfg" ]; then
sed -i "s/MAX_RAM=[^;]*/MAX_RAM=${MAX_MEMORY}/" "${FTB_DIR}/settings.cfg"
fi
# patch CurseForge cfg file, if present
if [ -f "${FTB_DIR}/settings.cfg" ]; then
sed -i "s/MAX_RAM=[^;]*/MAX_RAM=${MAX_MEMORY}/" "${FTB_DIR}/settings.cfg"
fi

cd "${FTB_DIR}"
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
if isTrue ${DEBUG_EXEC}; then
set -x
fi
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
cd "${FTB_DIR}"
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
if isTrue ${DEBUG_EXEC}; then
set -x
fi
exec mc-server-runner ${mcServerRunnerArgs} "${FTB_SERVER_START}"
else
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ]; then
Expand Down

0 comments on commit 06cffd9

Please sign in to comment.