From 12422a5ea4f81e4f7ca9f98a299362f16faca286 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 17 Apr 2020 14:21:13 +0200 Subject: [PATCH] buildscript: check selected_bsp link target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While buildscript checks whether selected_bsp exists, it does not verify whether it is pointing to a sensible direction. Since we use the target file name and content to derive build folders etc., though, this patch adds a check and exits the script if the link is broken. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- buildscript | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/buildscript b/buildscript index c418c1e..d0eba00 100755 --- a/buildscript +++ b/buildscript @@ -360,7 +360,14 @@ clean() { loadBSP() { - echo "Working with $(/bin/ls -l selected_bsp | awk '{ print $11 }')" + localbsppath=$(/bin/ls -l selected_bsp | awk '{ print $11 }') + + if ! [ -s selected_bsp ]; then + echo "Error: $localbsppath does not exist. Aborting ..." + exit 1 + fi + + echo "Working with $localbsppath" . selected_bsp machine=$(basename $(realpath selected_bsp) .bsp) }