botc-mc-scripts/load-script.sh
Nick Guy eefb13c59b Update script file path to include 'scripts' subdirectory
Adjusted the file path resolution to include the 'scripts' folder for better organization and alignment with directory structure. Fallback to the default template remains unchanged.
2025-06-02 22:17:15 +01:00

31 lines
No EOL
810 B
Bash
Executable file

#/usr/bin/env bash
DIR=$(realpath $(dirname $0))
script_name=$1
shift
if [[ -e /.dockerenv ]]; then
root_dir="/scripts"
else
root_dir="/pelican/data/botc"
fi
if [[ "${script_name}x" != "x" ]]; then
script_file="${root_dir}/scripts/${script_name}.png"
else
script_file="${DIR}/templates/map_background.png"
fi
# Instantiate template
map_file="${DIR}/templates/texture-pack/assets/minecraft/textures/map/map_background.png"
rm ${map_file}
echo "Deploying \"${script_file}\" to \"${map_file}\""
cp ${script_file} ${map_file}
# Package resource pack
pushd "${DIR}/templates"
mkdir -p "${root_dir}/files"
rm "${root_dir}/files/botc-script-resource-pack.zip"
zip -r "${root_dir}/files/botc-script-resource-pack.zip" texture-pack
echo "Writing to \"${root_dir}/files/botc-script-resource-pack.zip\""
popd