build: fix shellcheck errors

This commit is contained in:
Starbeamrainbowlabs 2025-03-12 11:43:57 +00:00
parent f8acbee1f0
commit f7ca65bf1e
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

20
build
View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Make sure the current directory is the location of this script to simplify matters # Make sure the current directory is the location of this script to simplify matters
cd "$(dirname $(readlink -f $0))"; cd "$(dirname "$(readlink -f "${0}")")";
################ ################
### Settings ### ### Settings ###
################ ################
@ -23,11 +23,13 @@ lantern_path="./lantern-build-engine";
# Check out the lantern git submodule if needed # Check out the lantern git submodule if needed
if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi
#shellcheck disable=SC1091
source "${lantern_path}/lantern.sh"; source "${lantern_path}/lantern.sh";
if [[ "$#" -lt 1 ]]; then if [[ "$#" -lt 1 ]]; then
echo -e "${FBLE}${project_name}${RS} build script"; echo -e "${FBLE}${project_name}${RS} build script";
echo -e " by Starbeamrainbowlabs"; echo -e " by Starbeamrainbowlabs";
#shellcheck disable=SC2154
echo -e "${LC}Powered by the lantern build engine, v${version}${RS}"; echo -e "${LC}Powered by the lantern build engine, v${version}${RS}";
echo -e ""; echo -e "";
echo -e "${CSECTION}Usage${RS}"; echo -e "${CSECTION}Usage${RS}";
@ -35,7 +37,7 @@ if [[ "$#" -lt 1 ]]; then
echo -e ""; echo -e "";
echo -e "${CSECTION}Available actions${RS}"; echo -e "${CSECTION}Available actions${RS}";
echo -e " ${CACTION}setup${RS} - Perform initial setup"; echo -e " ${CACTION}setup${RS} - Perform initial setup";
echo -e " ${CACTION}render${RS} - Render the LaTeX exmaples"; echo -e " ${CACTION}render${RS} - Render the LaTeX examples";
echo -e ""; echo -e "";
exit 1; exit 1;
@ -77,14 +79,14 @@ _render-latex-pdf() {
task_end $? "Failed to enter directory (does it exist?)"; task_end $? "Failed to enter directory (does it exist?)";
task_begin "Cleaning up"; task_begin "Cleaning up";
find -iname "*.aux" -delete; # Ref: https://tex.stackexchange.com/q/381057 find . -iname "*.aux" -delete; # Ref: https://tex.stackexchange.com/q/381057
find -iname "*.bbl" -delete; find . -iname "*.bbl" -delete;
find -iname "*.blg" -delete; find . -iname "*.blg" -delete;
find -iname "*.out" -delete; find . -iname "*.out" -delete;
task_end $? "Error: Failed to clean up after last build"; task_end $? "Error: Failed to clean up after last build";
# task_begin "Rendering images"; # task_begin "Rendering images";
# # FUTURE: Do this in paralell? # # FUTURE: Do this in parallel?
# for svg_filename in $(find "images/" -type f -iname "*.svg"); do # for svg_filename in $(find "images/" -type f -iname "*.svg"); do
# execute inkscape -e ${svg_filename%%.svg}.png ${svg_filename}; # execute inkscape -e ${svg_filename%%.svg}.png ${svg_filename};
# exit_code=$?; # exit_code=$?;
@ -105,7 +107,7 @@ _render-latex-pdf() {
task_end $? "Error: Failed to build report"; task_end $? "Error: Failed to build report";
task_begin "Moving report"; task_begin "Moving report";
execute mv *.pdf ..; execute mv ./*.pdf ..;
task_end $? "Failed to move report"; task_end $? "Failed to move report";
cd -; cd -;
@ -114,4 +116,4 @@ _render-latex-pdf() {
############################################################################### ###############################################################################
tasks_run $@; tasks_run "$@";