botc-mc-scripts/load-script.sh
Nick Guy a334ba6823 Refactor script paths to use dynamic root directory
Replaced hardcoded paths with dynamic root directory selection based on the environment. Removed unused variable and simplified the `load-script.sh` invocation. These changes improve maintainability and adaptability for different environments.
2025-06-02 22:13:10 +01:00

29 lines
No EOL
677 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}/${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}
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
popd