#!/usr/bin/env bash # Stages a scratch, patched copy of src/hacked/ at the given destination - # shared by process-mods.sh (mdlp) and ../gen_animgallery.sh (animgallery), # both of which build against hacked's source directly (via their own # go.mod's `replace ../hacked`) and so both need the same patches applied # that hacked-build-image/build-hacked.sh already applies for hacked's own # binary. src/hacked/ is never built or patched in place. # # Usage: stage-hacked.sh set -euo pipefail MODDING_ROOT="$1" DEST="$2" rm -rf "$DEST" mkdir -p "$(dirname "$DEST")" cp -a "$MODDING_ROOT/src/hacked" "$DEST" for p in "$MODDING_ROOT"/src/hacked-patches/*.patch; do patch -p1 -d "$DEST" < "$p" done