blobutil/extract: simplified main()

fsdg20230625
Leah Rowe 2023-05-14 09:24:31 +01:00
parent 1ffb32b78f
commit 1f8ad1e46a
1 changed files with 18 additions and 24 deletions

View File

@ -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 $@