From a33e5c67f3be27eb236c7046db8a459ae9dee5c1 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 15 May 2023 01:07:32 +0100 Subject: download/coreboot: split config check to function --- resources/scripts/download/coreboot | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'resources/scripts') diff --git a/resources/scripts/download/coreboot b/resources/scripts/download/coreboot index 6e4b0d44..87f38987 100755 --- a/resources/scripts/download/coreboot +++ b/resources/scripts/download/coreboot @@ -78,31 +78,16 @@ download_for_board() cbrevision="undefined" cbtree="undefined" - if [ ! -f "resources/coreboot/${_board}/board.cfg" ]; then - printf "ERROR: download/coreboot: board.cfg does not" - printf " exist for '%s'\n" ${_board} - return 1 - fi - - if [ -f "resources/coreboot/${_board}/seen" ]; then - printf "ERROR: download/coreboot: logical loop:" - printf " '%s' board.cfg refers to another tree," \ - ${_board} - printf " which ultimately refers back to '%s'." \ - ${_board} - return 1 - fi + check_config_for_board "${_board}" || return 1 # This is to override $cbrevision and $cbtree . "resources/coreboot/${_board}/board.cfg" \ || touch ../build_error - if [ -f build_error ]; then printf "ERROR: download/coreboot:" printf " problem sourcing %s/board.cfg\n" ${_board} return 1 fi - touch "resources/coreboot/${_board}/seen" if [ "${_board}" != "${cbtree}" ]; then _board="${cbtree}" @@ -233,6 +218,22 @@ download_for_board() fi } +check_config_for_board() +{ + if [ ! -f "resources/coreboot/${1}/board.cfg" ]; then + printf "ERROR: download/coreboot: board.cfg does not" + printf " exist for '%s'\n" ${1} + return 1 + elif [ -f "resources/coreboot/${1}/seen" ]; then + printf "ERROR: download/coreboot: logical loop:" + printf " '%s' board.cfg refers to another tree," ${1} + printf " which ultimately refers back to '%s'." ${1} + return 1 + fi + touch "resources/coreboot/${1}/seen" + return 0 +} + usage() { progname="./download coreboot" -- cgit v1.2.1