Move some proj detection code inside pre_check_environment

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2024-08-06 17:35:38 +01:00
parent bda3e46846
commit b55679736b

View File

@ -116,12 +116,6 @@ set -e -o pipefail -u
shopt -s extglob shopt -s extglob
# For project detection # For project detection
PROJECT_NAME_FILE='./scripts/project_name.txt'
if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else
echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2
exit 1
fi
in_mbedtls_repo () { in_mbedtls_repo () {
test "$PROJECT_NAME" = "Mbed TLS" test "$PROJECT_NAME" = "Mbed TLS"
} }
@ -131,6 +125,13 @@ in_tf_psa_crypto_repo () {
} }
pre_check_environment () { pre_check_environment () {
# For project detection
PROJECT_NAME_FILE='./scripts/project_name.txt'
if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else
echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2
exit 1
fi
if in_mbedtls_repo || in_tf_psa_crypto_repo; then :; else if in_mbedtls_repo || in_tf_psa_crypto_repo; then :; else
echo "Must be run from Mbed TLS / TF-PSA-Crypto root" >&2 echo "Must be run from Mbed TLS / TF-PSA-Crypto root" >&2
exit 1 exit 1