From 7164d2b8857d9e16c1ee2b01290df69ad019632e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 28 Apr 2021 16:29:47 -0500 Subject: [PATCH 1/2] Fixed REMOVE_OLD_MODS when directories not present #851 --- start-finalSetupModpack | 3 ++- start-spiget | 2 +- start-utils | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/start-finalSetupModpack b/start-finalSetupModpack index 9cd3b5c5..4c0bcf8c 100644 --- a/start-finalSetupModpack +++ b/start-finalSetupModpack @@ -12,7 +12,8 @@ CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects} # Remove old mods/plugins if isTrue ${REMOVE_OLD_MODS:-false}; then - find /data/mods /data/plugins -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete + removeOldMods /data/mods + removeOldMods /data/plugins fi # If supplied with a URL for a modpack (simple zip of jars), download it and unpack diff --git a/start-spiget b/start-spiget index d1902c09..025edd20 100644 --- a/start-spiget +++ b/start-spiget @@ -47,7 +47,7 @@ getResourceFromSpiget() { if [[ ${SPIGET_RESOURCES} ]]; then if isTrue ${REMOVE_OLD_MODS:-false}; then - rm -rf /data/plugins + removeOldMods /data/plugins REMOVE_OLD_MODS=false fi diff --git a/start-utils b/start-utils index 05f569ce..b85c7044 100644 --- a/start-utils +++ b/start-utils @@ -174,3 +174,9 @@ eula=${EULA,,} exit 2 fi } + +function removeOldMods { + if [ -d "$1" ]; then + find "$1" -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete + fi +} From 3261fbd7e9dabd4e0379b6103492b201a7a10d77 Mon Sep 17 00:00:00 2001 From: Krzysztof Zdulski Date: Wed, 28 Apr 2021 23:44:39 +0200 Subject: [PATCH 2/2] Support FTP servers for file downloads (#850) --- start-finalSetupModpack | 4 ++-- start-utils | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/start-finalSetupModpack b/start-finalSetupModpack index 4c0bcf8c..869d8c22 100644 --- a/start-finalSetupModpack +++ b/start-finalSetupModpack @@ -25,12 +25,12 @@ if [[ "$MODPACK" ]]; then downloadUrl=$(curl -Ls -o /dev/null -w %{effective_url} $MODPACK) if ! [[ $downloadUrl == *.zip ]]; then log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK" - log " Must be HTTP or HTTPS and a ZIP file" + log " Must be HTTP, HTTPS or FTP and a ZIP file" exit 1 fi fi - log "Downloading mod/plugin pack via HTTP" + log "Downloading mod/plugin pack" log " from $downloadUrl ..." if ! curl -sSL -o /tmp/modpack.zip "$downloadUrl"; then log "ERROR: failed to download from $downloadUrl" diff --git a/start-utils b/start-utils index b85c7044..2c8909c1 100644 --- a/start-utils +++ b/start-utils @@ -11,7 +11,7 @@ function join_by() { function isURL() { local value=$1 - if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then + if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" || ${value:0:6} == "ftp://" ]]; then return 0 else return 1