botc-mc-scripts/load-script.sh
Nick Guy c8fbd6326d Fix file path handling in load-script.sh
Wrapped file paths in quotes to prevent issues with spaces or special characters in directory names. Ensures reliability and robustness when processing files.
2025-06-02 22:19:11 +01:00

31 lines
No EOL
814 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