build/grub: implement error handling
it uses a subshell, so errors weren't observed Signed-off-by: Leah Rowe <leah@libreboot.org>fsdg20230625
parent
5bab3bbc33
commit
02919c47ce
|
@ -27,25 +27,35 @@ main()
|
||||||
printf "Building GRUB\n"
|
printf "Building GRUB\n"
|
||||||
|
|
||||||
if [ ! -d "grub/" ]; then
|
if [ ! -d "grub/" ]; then
|
||||||
./download grub
|
./download grub || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
build_grub
|
||||||
}
|
}
|
||||||
|
|
||||||
build_grub()
|
build_grub()
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
cd grub/
|
cd grub/ || err "cd"
|
||||||
|
|
||||||
# clean up first
|
# clean up first
|
||||||
[ -d Makefile ] && make distclean
|
if [ -d Makefile ]; then
|
||||||
|
make distclean || err "make-distclean"
|
||||||
|
fi
|
||||||
|
|
||||||
./bootstrap --gnulib-srcdir=gnulib/ --no-git
|
./bootstrap --gnulib-srcdir=gnulib/ --no-git || err "bootstrap"
|
||||||
|
|
||||||
# build
|
# build
|
||||||
./autogen.sh
|
./autogen.sh || err "autogen"
|
||||||
./configure --with-platform=coreboot
|
./configure --with-platform=coreboot || err "configure"
|
||||||
make -j$(nproc)
|
make -j$(nproc) || err "make"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err()
|
||||||
|
{
|
||||||
|
printf "%s: error: %s\n" $0 $1
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
main $@
|
main $@
|
||||||
|
|
Loading…
Reference in New Issue