SM2Gen/SM2GenAll.sh

41 lines
995 B
Bash
Executable File

#!/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."