New logger with color and specific types. Code cleanup (#3108)

This commit is contained in:
Tristan
2024-10-22 23:04:38 +02:00
committed by GitHub
parent a356c6810e
commit bef7b4719f
38 changed files with 424 additions and 428 deletions

View File

@@ -25,7 +25,7 @@ loadForgeVars() {
isDebugging && set -x
if [[ ${VERSION^^} == LATEST ]]; then
log "WARNING for the old TYPE=CURSEFORGE mechanism it is best to set VERSION to a specific value"
logWarning "For the old TYPE=CURSEFORGE mechanism it is best to set VERSION to a specific value"
fi
resolveVersion
@@ -39,7 +39,7 @@ FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
log "Looking for Feed-The-Beast / CurseForge server modpack."
if [[ ! $FTB_SERVER_MOD ]]; then
log "ERROR: CF_SERVER_MOD or FTB_SERVER_MOD is required to be set"
logError "CF_SERVER_MOD or FTB_SERVER_MOD is required to be set"
exit 1
fi
@@ -48,7 +48,7 @@ downloadModpack() {
if isURL "${srv_modpack}"; then
log "Downloading modpack from ${srv_modpack}..."
if ! srv_modpack=$(get -o /data --output-filename --skip-existing "${srv_modpack}"); then
log "ERROR: failed to download modpack"
logError "Failed to download modpack"
exit 1
fi
fi
@@ -61,12 +61,12 @@ downloadModpack() {
srv_modpack=/data/${srv_modpack}
fi
if [[ ! -f "${srv_modpack}" ]]; then
log "FTB server modpack ${srv_modpack} not found."
logError "FTB server modpack: ${srv_modpack} not found."
exit 2
fi
if [[ ! "${srv_modpack: -4}" == ".zip" ]]; then
log "FTB server modpack ${srv_modpack} is not a zip archive."
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
logError "FTB server modpack: ${srv_modpack} is not a zip archive."
logError "Please set FTB_SERVER_MOD to a file with a .zip extension."
exit 2
fi
FTB_SERVER_MOD=${srv_modpack}
@@ -104,7 +104,7 @@ if ! isTrue "${USE_MODPACK_START_SCRIPT:-true}"; then
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"
logError "Failed to download Forge installer from $forgeInstallerUrl"
exit 2
fi
fi
@@ -113,9 +113,9 @@ if ! isTrue "${USE_MODPACK_START_SCRIPT:-true}"; then
fi
if [[ -z "${forgeInstallerJar}" ]]; then
log "ERROR Unable to find forge installer in modpack"
log " or download using modpack config."
log " Make sure you downloaded the server files."
logError "Unable to find forge installer in modpack"
logError " or download using modpack config."
logError " Make sure you downloaded the server files."
exit 2
fi
@@ -129,7 +129,7 @@ if ! isTrue "${USE_MODPACK_START_SCRIPT:-true}"; then
SERVER=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f \( -path "/libraries/*" -o -path "/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
log "ERROR unable to locate installed forge server jar"
logError "Unable to locate installed forge server jar"
isDebugging && find "${FTB_BASE_DIR}" -name "forge*.jar"
exit 2
fi
@@ -213,7 +213,7 @@ EOF
startScript="${FTB_BASE_DIR}/ServerStart.sh"
chmod +x "$startScript"
else
log "ERROR: Modpack missing start script and unable to find Forge jar to generate one"
logError "Modpack missing start script and unable to find Forge jar to generate one"
exit 2
fi
fi
@@ -244,7 +244,7 @@ legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
if isTrue "${FTB_LEGACYJAVAFIXER}" && [ ! -e "${legacyJavaFixerPath}" ]; then
log "Installing legacy java fixer to ${legacyJavaFixerPath}"
if ! get -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl}; then
log "ERROR failed to download legacy java fixer from ${legacyJavaFixerUrl}"
logError "Failed to download legacy java fixer from ${legacyJavaFixerUrl}"
exit 1
fi
fi