diff options
author | Leah Rowe <leah@libreboot.org> | 2023-05-15 01:07:32 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-05-15 01:07:32 +0100 |
commit | a33e5c67f3be27eb236c7046db8a459ae9dee5c1 (patch) | |
tree | 35592c792a6b18862376e8fbdb812cb5510d161c | |
parent | 62038f1d03d3626854b405b5e42f17c82053c12f (diff) |
download/coreboot: split config check to function
-rwxr-xr-x | resources/scripts/download/coreboot | 33 |
1 files changed, 17 insertions, 16 deletions
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" |