summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-27 11:38:22 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-27 11:38:22 +0100
commit28f03d39cb1a7cfa8db46b3875557a530aebdd46 (patch)
tree6bd05af6c62b7b151278800c2a3bdab83144555f
parent46f7d48c8d7a7390a55e3c3bff914b68881a34bd (diff)
inject.sh: simplify remktar()
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--include/inject.sh22
-rw-r--r--include/vendor.sh4
2 files changed, 11 insertions, 15 deletions
diff --git a/include/inject.sh b/include/inject.sh
index 9354b439..09d155fd 100644
--- a/include/inject.sh
+++ b/include/inject.sh
@@ -13,7 +13,7 @@ cv="CONFIG_GBE_BIN_PATH"
[ -n "$cvchk" ] && cv="$cv $cvchk"
eval "`setvars "" archive boarddir IFD_platform ifdprefix tree new_mac \
- tmpromdir board xchanged $cv`"
+ tdir board xchanged $cv`"
inject()
{
@@ -41,7 +41,8 @@ inject()
x_ e "$archive" f && check_release
check_target && patch_release
- [ "$xchanged" = "y" ] && remktar
+ [ "$xchanged" != "y" ] || ( remktar ) || err
+ x_ mv "${tdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" "$archive"
xnot=" NOT" && [ "$xchanged" = "y" ] && xnot=""
printf "\n'%s' was%s modified\n" "$archive" "$xnot" 1>&2
@@ -80,13 +81,13 @@ patch_release()
[ "$nuke" = "nuke" ] || x_ ./mk download "$board"
has_hashes="n"
- tmpromdir="$tmpromdel/bin/$board"
+ tdir="$tmpromdel/bin/$board"
- remkdir "${tmpromdir%"/bin/$board"}"
- x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
+ remkdir "${tdir%"/bin/$board"}"
+ x_ tar -xf "$archive" -C "${tdir%"/bin/$board"}"
for _hashes in "vendorhashes" "blobhashes"; do
- e "$tmpromdir/$_hashes" f && \
+ e "$tdir/$_hashes" f && \
has_hashes="y" && hashfile="$_hashes" && break; :
done
@@ -117,7 +118,7 @@ modify_mac()
x_ make -C util/nvmutil clean && x_ make -C util/nvmutil && \
x_ "$nvm" "$xbloc/gbe" setmac "$new_mac"
- fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
+ fx_ newmac x_ find "$tdir" -maxdepth 1 -type f -name "*.rom"
printf "\nThe following GbE NVM data will be written:\n"
x_ "$nvm" "$xbloc/gbe" dump | grep -v "bytes read from file" || :
@@ -131,12 +132,7 @@ newmac()
remktar()
{
- (
- x_ cd "${tmpromdir%"/bin/$board"}"
+ x_ cd "${tdir%"/bin/$board"}"
printf "Re-building tar archive (please wait)\n"
mkrom_tarball "bin/$board" 1>/dev/null
- ) || err "Cannot re-generate '$archive'"
-
- mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
- "$archive" || err "'$archive' -> Can't overwrite"; :
}
diff --git a/include/vendor.sh b/include/vendor.sh
index 55373913..e92e811a 100644
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -261,7 +261,7 @@ getvfile()
{
eval "`setcfg "config/vendor/$vcfg/pkg.cfg" 1`"
bootstrap && [ $# -gt 0 ] && getfiles && return 0 # download
- fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
+ fx_ prep x_ find "$tdir" -maxdepth 1 -type f -name "*.rom"
( check_vendor_hashes ) || err "$archive: Can't verify hashes"; :
}
@@ -395,7 +395,7 @@ vfile()
check_vendor_hashes()
{
- x_ cd "$tmpromdir"
+ x_ cd "$tdir"
[ "$has_hashes" = "n" ] || [ "$nuke" = "nuke" ] || sha512sum \
--status -c "$hashfile" || x_ sha1sum --status -c "$hashfile"
x_ rm -f "$hashfile"