From 5ad745de75ff62e27854fc026be48b46793839ac Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 29 Sep 2019 11:45:21 -0500 Subject: [PATCH] Initial support for GENERIC_PACK For #392 --- start-finalSetup02Modpack | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/start-finalSetup02Modpack b/start-finalSetup02Modpack index 25cd680d..782377c0 100644 --- a/start-finalSetup02Modpack +++ b/start-finalSetup02Modpack @@ -1,5 +1,9 @@ #!/bin/bash +set -e + +. /start-utils + # CURSE_URL_BASE used in manifest downloads below CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects} @@ -106,4 +110,25 @@ case "X$EFFECTIVE_MANIFEST_URL" in esac fi +if [[ "${GENERIC_PACK}" ]]; then + if isURL "${GENERIC_PACK}"; then + generic_pack_url=${GENERIC_PACK} + GENERIC_PACK=/tmp/$(basename ${generic_pack_url}) + echo "Downloading generic pack from ${generic_pack_url} ..." + curl -fsSL -o ${GENERIC_PACK} ${generic_pack_url} + fi + + sum_file=/data/.generic_pack.sum + if ! sha256sum -c ${sum_file} -s 2> /dev/null; then + base_dir=/tmp/generic_pack_base + mkdir -p ${base_dir} + unzip -q -d ${base_dir} ${GENERIC_PACK} + depth=$(( ${GENERIC_PACK_STRIP_DIRS:-1} + 1 )) + echo "Applying generic pack, stripping $(( depth - 1 )) level ..." + find ${base_dir} -type d -mindepth $depth -maxdepth $depth -exec cp -r {} /data/ + + rm -rf ${base_dir} + sha256sum ${GENERIC_PACK} > ${sum_file} + fi +fi + exec /start-finalSetup03Modconfig $@