#!/bin/bash
set -e

cd /home/container

echo "Patching Blockland..."

if [ -n "$BL_PATCH_EXE_URL" ]; then
    curl -fsSLJ --clobber -o Blockland.exe "$BL_PATCH_EXE_URL"
fi

if [ -n "$BL_PATCH_LOADER_URL" ]; then
    curl -fsSLJ --clobber -o RedBlocklandLoader.dll "$BL_PATCH_LOADER_URL"
fi

if [ -n "$BL_PATCH_WINEFIX_URL" ]; then
    mkdir -p ./modules
    curl -fsSLJ --clobber \
        --output-dir ./modules/ \
        -o WineFix.dll \
        "$BL_PATCH_WINEFIX_URL"
fi