mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-14 07:19:40 +02:00
vendor.sh: tidy up vendor_inject()
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+5
-29
@@ -342,7 +342,7 @@ fail_inject()
|
||||
|
||||
vendor_inject()
|
||||
{
|
||||
need_files="n" # will be set to "y" if vendorfiles needed
|
||||
need_files="n"
|
||||
_olderr="$err"
|
||||
err="fail_inject"
|
||||
remkdir "$tmpromdel"
|
||||
@@ -351,34 +351,21 @@ vendor_inject()
|
||||
[ $# -lt 1 ] && $err "No options specified. - $dontflash"
|
||||
eval "`setvars "" nukemode new_mac xchanged`"
|
||||
|
||||
# randomise the MAC address by default
|
||||
# TODO: support setting CBFS MAC address for GA-G41M-ES2L
|
||||
archive="$1";
|
||||
new_mac="??:??:??:??:??:??"
|
||||
|
||||
archive="$1";
|
||||
[ $# -gt 1 ] && case "$2" in
|
||||
nuke)
|
||||
new_mac=""
|
||||
nukemode="nuke" ;;
|
||||
setmac)
|
||||
[ $# -gt 2 ] && new_mac="$3" && \
|
||||
[ -z "$new_mac" ] && $err \
|
||||
"You set an empty MAC address string" ;;
|
||||
[ -z "$new_mac" ] && $err "Empty MAC address specified" ;;
|
||||
*) $err "Unrecognised inject mode: '$2'"
|
||||
esac
|
||||
|
||||
# allow the user to skip setting MAC addresses.
|
||||
# if new_mac is empty, this script skips running nvmutil
|
||||
[ "$new_mac" = "keep" ] && new_mac=""
|
||||
|
||||
# we don't allow the *user* to clear new_mac, in the setmac
|
||||
# command, in case the build system is being integrated with
|
||||
# another, where setmac is relied upon and is being set
|
||||
# explicitly. this is a preventative error handle, as a courtes
|
||||
# to that hypothetical user e.g. Linux distro package maintainer
|
||||
# integrating this build system into their distro. if they used
|
||||
# a variable for that, and they forgot to initialise it, they'll know.
|
||||
|
||||
check_release "$archive" || \
|
||||
$err "You must run this script on a release archive. - $dontflash"
|
||||
|
||||
@@ -416,24 +403,13 @@ vendor_inject()
|
||||
"Board '%s' doesn't use vendorfiles, so none were inserted.\n" \
|
||||
"$board"
|
||||
|
||||
#
|
||||
# catch-all error handler, for libreboot release opsec:
|
||||
#
|
||||
# if vendor files defined, and a hash file was missing, that means
|
||||
# a nuke must succeed, if specified. if no hashfile was present,
|
||||
# that means vendorfiles had been injected, so a nuke must succeed.
|
||||
# this check is here in case of future bugs in lbmk's handling
|
||||
# of vendorfile deletions on release archives, which absolutely
|
||||
# must always be 100% reliable, so paranoia is paramount:
|
||||
#
|
||||
if [ "$xchanged" != "y" ] && [ "$need_files" = "y" ] && \
|
||||
[ "$nukemode" = "nuke" ] && [ "$has_hashes" != "y" ]; then
|
||||
printf "FAILED NUKE: tarball '$archive', board '$board'\n" 1>&2
|
||||
$err "Unhandled vendorfile deletion: DO NOT RELEASE TO RSYNC"
|
||||
fi # of course, we assume that those variables are also set right
|
||||
fi
|
||||
|
||||
err="$_olderr"
|
||||
return 0
|
||||
err="$_olderr"; :
|
||||
}
|
||||
|
||||
check_release()
|
||||
|
||||
Reference in New Issue
Block a user