From: Ross Burton Date: Thu, 18 Dec 2025 17:42:43 +0000 (+0000) Subject: scripts/makefile-getvar: be more resilient X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f5a8a0c99fd2330e155ab97df299ca74d7e9561;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git scripts/makefile-getvar: be more resilient Check that we've been passed enough arguments (at least the Makefile and one variable), and that the Makefile specified is actually a file. Signed-off-by: Ross Burton Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/scripts/makefile-getvar b/scripts/makefile-getvar index 4a07055e68..e8a9832766 100755 --- a/scripts/makefile-getvar +++ b/scripts/makefile-getvar @@ -11,9 +11,20 @@ set -eu +if [ $# -lt 2 ]; then + echo "Get a variable's value from a Makefile:" + echo "$ makefile-getvar Makefile VARIABLE VARIABLE ..." + exit 0 +fi + MAKEFILE=$1 shift +if [ ! -f $MAKEFILE ]; then + echo $MAKEFILE is not a file + exit 1 +fi + for VARIABLE in $*; do make -f - $VARIABLE.var <