From c7f22b54f898a75270d601b3bdfe5ef09e4be6f0 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Wed, 18 Sep 2024 11:48:41 +0100 Subject: [PATCH] Add in bash script to run everything --- SM2GenAll.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 SM2GenAll.sh diff --git a/SM2GenAll.sh b/SM2GenAll.sh new file mode 100755 index 0000000..579f9b8 --- /dev/null +++ b/SM2GenAll.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Check for two parameters +if [ $# -ne 2 ]; then + echo "Error: requires two parameters." + echo "Usage: SM2GenAll.sh " + 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."