From 28810fcba3e85415b4beca42a908238ee3a3eb3d Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 14 Mar 2021 15:02:40 -0500 Subject: [PATCH] Added support for CF modpacks using settings.cfg #772 #800 --- start-deployCF | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/start-deployCF b/start-deployCF index 86bd44ca..a881e7bc 100644 --- a/start-deployCF +++ b/start-deployCF @@ -3,6 +3,24 @@ set -e . ${SCRIPTS:-/}start-utils + +loadForgeVars() { + cfgFile=${1?} + pat='^([^#;][^=]+)=[:space:]*([^;]*)' + while read -r line || [[ -n "$line" ]] ; do + if [[ $line =~ $pat ]]; then + #echo "MATCHED $line" + k=${BASH_REMATCH[1]} + v=${BASH_REMATCH[2]} + case $k in + FORGEURL) + forgeInstallerUrl="$v" + ;; + esac + fi + done < "$cfgFile" +} + isDebugging && set -x : ${FTB_BASE_DIR:=${CF_BASE_DIR:-/data/FeedTheBeast}} @@ -44,9 +62,24 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then serverJar=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar") if [[ -z "$serverJar" ]]; then - forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") + + if [ -f "${FTB_BASE_DIR}/settings.cfg" ]; then + loadForgeVars "${FTB_BASE_DIR}/settings.cfg" + + if [[ $forgeInstallerUrl ]]; then + forgeInstallerJar="${FTB_BASE_DIR}/forge-installer.jar" + if ! curl -fsSL -o "$forgeInstallerJar" "$forgeInstallerUrl" ; then + log "ERROR failed to download Forge installer from $forgeInstallerUrl" + exit 2 + fi + fi + else + forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar") + fi + if [[ -z "${forgeInstallerJar}" ]]; then - log "ERROR Unable to find forge installer in modpack." + log "ERROR Unable to find forge installer in modpack" + log " or download using modpack config." log " Make sure you downloaded the server files." exit 2 fi