58 lines
1.8 KiB
Bash
Executable File
58 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# ------------------------------------------------------------------
|
|
# build_and_rename.sh
|
|
#
|
|
# This script reads a tiny “configuration” (defined right inside the
|
|
# file, but it can be replaced by an external .conf or .txt file).
|
|
#
|
|
# For every entry in that configuration it will:
|
|
# * call `./build.sh player` with the options supplied for that
|
|
# entry,
|
|
# * rename/move the produced PDF (`Player_handbook_build.pdf`)
|
|
# to the name specified by the entry.
|
|
#
|
|
# Example usage (from a terminal in the directory containing this
|
|
# script and build.sh):
|
|
#
|
|
# ./build_and_rename.sh
|
|
#
|
|
# ------------------------------------------------------------------
|
|
set -euo pipefail # Fail fast on error, treat unset vars as errors
|
|
|
|
#######################
|
|
## Configuration area ##
|
|
#######################
|
|
|
|
# Each line has: <output_name> [options…]
|
|
mkdir Handbooks
|
|
entries=(
|
|
"Handbooks/Player_handbook_eduald -o origines_stats_handbook_abyssal_1"
|
|
"Handbooks/Player_handbook_michel -o fra"
|
|
# Add more lines like above as needed
|
|
)
|
|
|
|
##########################
|
|
## Main processing loop ##
|
|
##########################
|
|
|
|
for entry in "${entries[@]}"; do
|
|
# Split the string into the name (first word) and the options (rest)
|
|
output_name="${entry%% *}" # Everything before first space
|
|
options="${entry#$output_name }" # Everything after that
|
|
|
|
echo "=== Building for '$output_name' with options: $options ==="
|
|
|
|
# Run your build script
|
|
./build.sh player $options
|
|
|
|
# The build script is expected to produce Player_handbook_build.pdf.
|
|
# Move/rename it to the desired output name.
|
|
mv -f Player_handbook_build.pdf "${output_name}.pdf"
|
|
|
|
echo "'$output_name'.pdf ready."
|
|
done
|
|
|
|
echo
|
|
echo "All entries processed successfully."
|