Add in bash script to run everything

This commit is contained in:
Brian Read 2024-09-18 11:48:41 +01:00
parent b4a6be435c
commit c7f22b54f8

40
SM2GenAll.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# Check for two parameters
if [ $# -ne 2 ]; then
echo "Error: requires two parameters."
echo "Usage: SM2GenAll.sh <prefix> <packagename>"
exit 1
fi
# Navigate to the appropriate directory
cd /home/brianr/clients/SM2/SM2Gen/venv || { echo "Error: Failed to change directory."; exit 1; }
source /home/brianr/clients/SM2/SM2Gen/venv/bin/activate
# Check if the HTML file exists
if [ ! -f "html/$2.html" ]; then
echo "Warning: html/$2.html does not exist. Skipping the first program."
else
# Run the first program
python3 sm1-html-2-json5.py -f "$2.html"
if [ $? -ne 0 ]; then
echo "Error: sm1-html-2-json5.py failed."
exit 1
fi
fi
# Run the second program
python3 sm2gen.py -f json5/"$2.json5"
if [ $? -ne 0 ]; then
echo "Error: sm2gen.py failed."
exit 1
fi
# Run the copySM2 script
copySM2.sh SME11 "$1" "$2"
if [ $? -ne 0 ]; then
echo "Error: copySM2.sh failed."
exit 1
fi
echo "All steps completed successfully."