From 40e70e6822ec41b5f92e0c69165d75a48c8a8da4 Mon Sep 17 00:00:00 2001 From: QP Hou Date: Wed, 24 Nov 2021 19:30:20 -0800 Subject: [PATCH] extract_tools.sh: detect LFS installation + fix pull detection (#19) * fix extract_tools.sh for fresh clone * two spaces Co-authored-by: Adeeb Shihadeh --- tools/extract_tools.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/extract_tools.sh b/tools/extract_tools.sh index b922797..edfc28c 100755 --- a/tools/extract_tools.sh +++ b/tools/extract_tools.sh @@ -2,6 +2,11 @@ echo "Extracting tools..." +git lfs &> /dev/null || { + echo "ERROR: git lfs not installed" + exit 1 +} + DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" THIS_SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" ROOT=$DIR/.. @@ -13,15 +18,14 @@ GOOGLE_GCC_4_9=aarch64-linux-android-4.9 EDK2_LLVM=llvm-arm-toolchain-ship SEC_IMAGE=SecImage -if [ ! -f $LINARO_GCC*.gz ] || \ - [ ! -f $GOOGLE_GCC_4_9*.gz ] || \ - [ ! -f $EDK2_LLVM*.gz ] || \ - [ ! -f $SEC_IMAGE*.gz ]; then +# grep for `-`, which stands for LFS pointer +git lfs ls-files | awk '{print $2}' | grep "-" &>/dev/null && { + echo "Pulling git lfs objects..." cd $ROOT git lfs install git lfs pull cd $DIR -fi +} LINARO_GCC_TARBALL=$LINARO_GCC.tar.gz GOOGLE_GCC_4_9_TARBALL=$GOOGLE_GCC_4_9.tar.gz