diff options
| author | Leah Rowe <leah@libreboot.org> | 2025-05-04 09:56:21 +0100 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2025-05-04 10:13:42 +0100 | 
| commit | 54291ebb7209c314bb52f507bc6a1ecf2a28fbc9 (patch) | |
| tree | af71ac248c7570d944d82c6b2428eaacf70c9534 /include/mrc.sh | |
| parent | 3f7dc2a55f5b2273e73e17e4cec75faffe65740f (diff) | |
lbmk: MUCH safer err function
Don't directly call a variable. Call a function that
checks the variable instead.
The new err function also checks whether an exit was
actually done, and exits 1 if not.
If an exit was done by the given function, but the exit
was zero, this is also corrected to perform an exit 1.
This fixes a longstanding design flaw of lbmk.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/mrc.sh')
| -rw-r--r-- | include/mrc.sh | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/include/mrc.sh b/include/mrc.sh index eaf39dcb..a1dcb140 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -11,7 +11,7 @@ extract_mrc()  	extract_shellball  	"$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ -	    -f "$_dest" -r RO_SECTION || $err "extract_mrc: !$cbfstool $_dest" +	    -f "$_dest" -r RO_SECTION || err "extract_mrc: !$cbfstool $_dest"  	[ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode extra; :  } @@ -27,7 +27,7 @@ extract_refcode()  	# incompatible with older versions before coreboot 4.14,  	# so we need coreboot 4.13 cbfstool for certain refcode files  	chkvars cbfstoolref -	mkdir -p "${_refdest%/*}" || $err "ref: !mkdir -p ${_refdest%/*}" +	mkdir -p "${_refdest%/*}" || err "ref: !mkdir -p ${_refdest%/*}"  	x_ "$cbfstoolref" "$appdir/bios.bin" extract \  	    -m x86 -n fallback/refcode -f "$_refdest" -r RO_SECTION @@ -46,7 +46,7 @@ extract_shellball()  	x_ cd "$appdir"  	extract_partition "${MRC_url##*/}"  	extract_archive "$SHELLBALL" . -	) || $err "mrc download/extract failure"; : +	) || err "mrc download/extract failure"; :  }  extract_partition() @@ -59,8 +59,8 @@ extract_partition()  	SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) ))  	dd if="${1%.zip}" of="root-a.ext2" bs=1024 skip=$(( $START / 1024 )) \ -	    count=$(( $SIZE / 1024 )) || $err "ex dd ${1%.zip}, root-a.ext2" +	    count=$(( $SIZE / 1024 )) || err "ex dd ${1%.zip}, root-a.ext2"  	printf "cd /usr/sbin\ndump chromeos-firmwareupdate %s\nquit" \ -	    "$SHELLBALL" | debugfs "root-a.ext2" || $err "!extract shellball" +	    "$SHELLBALL" | debugfs "root-a.ext2" || err "!extract shellball"  } | 
