diff options
| author | Leah Rowe <leah@libreboot.org> | 2023-05-20 18:10:41 +0100 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2023-05-20 18:10:41 +0100 | 
| commit | 02919c47ced4f02b17d873906f63e790a2a74dc1 (patch) | |
| tree | b3f9b7a0f06c73ebb5ebb50baa55e3525cebb9c1 | |
| parent | 5bab3bbc33c810cac1b04ab36fe273c614345d9a (diff) | |
build/grub: implement error handling
it uses a subshell, so errors weren't observed
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rwxr-xr-x | resources/scripts/build/module/grub | 24 | 
1 files changed, 17 insertions, 7 deletions
| diff --git a/resources/scripts/build/module/grub b/resources/scripts/build/module/grub index 1fdd7a26..4d466a68 100755 --- a/resources/scripts/build/module/grub +++ b/resources/scripts/build/module/grub @@ -27,25 +27,35 @@ main()  	printf "Building GRUB\n"  	if [ ! -d "grub/" ]; then -		./download grub +		./download grub || exit 1  	fi + +	build_grub  }  build_grub()  {  	( -	cd grub/ +	cd grub/ || err "cd"  	# 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 -	./autogen.sh -	./configure --with-platform=coreboot -	make -j$(nproc) +	./autogen.sh || err "autogen" +	./configure --with-platform=coreboot || err "configure" +	make -j$(nproc) || err "make"  	)  } +err() +{ +	printf "%s: error: %s\n" $0 $1 +	exit 1 +} +  main $@ | 
