From 52677309c529c6cbaad5cc76b39f2b9598488ed7 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Mon, 4 Sep 2023 15:57:48 +0100
Subject: update/blobs/extract: replace errant target code

check based on whether defconfigs are available, which
are used extensively, rather than checking based on
whether target.cfg is available, which is not used

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 script/update/blobs/extract | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

(limited to 'script/update/blobs/extract')

diff --git a/script/update/blobs/extract b/script/update/blobs/extract
index f44086a9..7b7ee2d5 100755
--- a/script/update/blobs/extract
+++ b/script/update/blobs/extract
@@ -37,22 +37,12 @@ main()
 	vendor_rom="${2}"
 	boarddir="${cbcfgsdir}/${board}"
 
-	check_board
+	[ -f "${vendor_rom}" ] || \
+		err "${board}: file does not exist: ${vendor_rom}"
 	build_dependencies
 	extract_blobs
 }
 
-check_board()
-{
-	if [ ! -f "${vendor_rom}" ]; then
-		err "check_board: ${board}: file does not exist: ${vendor_rom}"
-	elif [ ! -d "${boarddir}" ]; then
-		err "check_board: ${board}: target not defined"
-	elif [ ! -f "${boarddir}/target.cfg" ]; then
-		err "check_board: ${board}: missing target.cfg"
-	fi
-}
-
 build_dependencies()
 {
 	if [ ! -d me_cleaner ]; then
@@ -71,9 +61,13 @@ extract_blobs()
 {
 	printf "extracting blobs for %s from %s\n" ${board} ${vendor_rom}
 
+	no_config="printf \"No configs on target, %s\\n\" ${board} 1>&2; exit 1"
+	for x in "${boarddir}"/config/*; do
+		[ -f "${x}" ] && no_config=""
+	done
+	eval "${no_config}"
 	set -- "${boarddir}/config/"*
 	. "${1}" 2>/dev/null
-	. "${boarddir}/target.cfg"
 
 	[ "$CONFIG_HAVE_MRC" != "y" ] || \
 		./update blobs mrc || err "extract_blobs: can't fetch mrc"
-- 
cgit v1.2.1