inject.sh: tidy up patch_release_roms()

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.04_branch
Leah Rowe 2025-04-12 17:02:07 +01:00
parent ff35a6a300
commit cdcdadf097
1 changed files with 5 additions and 20 deletions

View File

@ -125,41 +125,26 @@ patch_release_roms()
{ {
tmpromdir="tmp/DO_NOT_FLASH/bin/$board" tmpromdir="tmp/DO_NOT_FLASH/bin/$board"
remkdir "${tmpromdir%"/bin/$board"}" remkdir "${tmpromdir%"/bin/$board"}"
tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" || \ x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
$err "Can't extract '$archive'"
for _hashes in $hashfiles; do for _hashes in $hashfiles; do
[ -L "$tmpromdir/$_hashes" ] && \ e "$tmpromdir/$_hashes" f && $err \
$err "'$archive' -> the hashfile is a symlink. $dontflash"
[ -f "$tmpromdir/$_hashes" ] && $err \
"'$archive': vendorfile insertion unsupported; $dontflash" "'$archive': vendorfile insertion unsupported; $dontflash"
done done
if [ -n "$new_mac" ]; then [ -z "$new_mac" ] || modify_mac_addresses || printf \
if ! modify_mac_addresses; then "\nNo GbE region defined for '%s'\n" "$board" 1>&2
printf "\nNo GbE region defined for '%s'\n" "$board" \
1>&2
printf "Therefore, changing the MAC is impossible.\n" \
1>&2
printf "This board probably lacks Intel ethernet.\n" \
1>&2
printf "(or it's pre-IFD Intel with Intel GbE NIC)\n" \
1>&2
fi
fi
[ "$xchanged" = "y" ] || rm -Rf "$tmpromdel" || : [ "$xchanged" = "y" ] || rm -Rf "$tmpromdel" || :
[ "$xchanged" = "y" ] || return 0 [ "$xchanged" = "y" ] || return 0
( (
cd "${tmpromdir%"/bin/$board"}" || \ cd "${tmpromdir%"/bin/$board"}" || \
$err "Can't cd '${tmpromdir%"/bin/$board"}'; $dontflash" $err "Can't cd '${tmpromdir%"/bin/$board"}'; $dontflash"
# ../../ is the root of lbmk
mkrom_tarball "bin/$board" mkrom_tarball "bin/$board"
) || $err "Cannot re-generate '$archive' - $dontflash" ) || $err "Cannot re-generate '$archive' - $dontflash"
mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
"$archive" || \ "$archive" || $err "'$archive' -> Can't overwrite - $dontflash"; :
$err "'$archive' -> Cannot overwrite - $dontflash"; :
} }
modify_mac_addresses() modify_mac_addresses()