summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-14 09:24:31 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-14 09:24:31 +0100
commit1f8ad1e46ae561126f8fb196a3c677117f786f43 (patch)
tree605aeee0188c9c241d16e06dd2fdfa7e75d50896 /resources
parent1ffb32b78fb144d032ad5805bb9a767707a8922e (diff)
blobutil/extract: simplified main()
Diffstat (limited to 'resources')
-rwxr-xr-xresources/scripts/blobs/extract42
1 files changed, 18 insertions, 24 deletions
diff --git a/resources/scripts/blobs/extract b/resources/scripts/blobs/extract
index eb8fa7f9..0f1e1f3a 100755
--- a/resources/scripts/blobs/extract
+++ b/resources/scripts/blobs/extract
@@ -19,28 +19,22 @@ main()
board="${1}"
vendor_rom="${2}"
- if [ ! -f "${vendor_rom}" ] ; then
- Print_help
- exit 1
- fi
-
- if [ ! -d "resources/coreboot/${board}" ]; then
- Print_help
- printf "build/roms %s: target not defined.\n" \
- "${projectname}" ${board}
- exit 1
- fi
-
- if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
- Print_help
- printf "build/roms %s: missing board.cfg.\n" ${board}
- exit 1
- fi
-
+ Check_board
Build_deps
Extract_blobs
}
+Check_board()
+{
+ if [ ! -f "${vendor_rom}" ] ; then
+ Fail "file does not exist: ${vendor_rom}"
+ elif [ ! -d "resources/coreboot/${board}" ]; then
+ Fail "build/roms ${board}: target not defined"
+ elif [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
+ Fail "build/roms ${board}: missing board.cfg"
+ fi
+}
+
Build_deps(){
if [ ! -d me_cleaner ]; then
printf "downloading me_cleaner\n"
@@ -106,16 +100,16 @@ Extract_blobs(){
fi
}
-Print_help(){
- printf "Usage: ./blobutil extract {boardname} {path/to/vendor_rom}\n"
- printf "Example: ./blobutil extract x230 12mb_flash.bin\n"
- printf "\nYou need to specify exactly 2 arguments\n"
-}
-
Fail(){
Print_help
printf "\n%s: ERROR: %s\n" ${sname} $@
exit 1
}
+Print_help(){
+ printf "Usage: ./blobutil extract {boardname} {path/to/vendor_rom}\n"
+ printf "Example: ./blobutil extract x230 12mb_flash.bin\n"
+ printf "\nYou need to specify exactly 2 arguments\n"
+}
+
main $@