mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-24 12:12:59 +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()
|
vendor_inject()
|
||||||
{
|
{
|
||||||
need_files="n" # will be set to "y" if vendorfiles needed
|
need_files="n"
|
||||||
_olderr="$err"
|
_olderr="$err"
|
||||||
err="fail_inject"
|
err="fail_inject"
|
||||||
remkdir "$tmpromdel"
|
remkdir "$tmpromdel"
|
||||||
@@ -351,34 +351,21 @@ vendor_inject()
|
|||||||
[ $# -lt 1 ] && $err "No options specified. - $dontflash"
|
[ $# -lt 1 ] && $err "No options specified. - $dontflash"
|
||||||
eval "`setvars "" nukemode new_mac xchanged`"
|
eval "`setvars "" nukemode new_mac xchanged`"
|
||||||
|
|
||||||
# randomise the MAC address by default
|
archive="$1";
|
||||||
# TODO: support setting CBFS MAC address for GA-G41M-ES2L
|
|
||||||
new_mac="??:??:??:??:??:??"
|
new_mac="??:??:??:??:??:??"
|
||||||
|
|
||||||
archive="$1";
|
|
||||||
[ $# -gt 1 ] && case "$2" in
|
[ $# -gt 1 ] && case "$2" in
|
||||||
nuke)
|
nuke)
|
||||||
new_mac=""
|
new_mac=""
|
||||||
nukemode="nuke" ;;
|
nukemode="nuke" ;;
|
||||||
setmac)
|
setmac)
|
||||||
[ $# -gt 2 ] && new_mac="$3" && \
|
[ $# -gt 2 ] && new_mac="$3" && \
|
||||||
[ -z "$new_mac" ] && $err \
|
[ -z "$new_mac" ] && $err "Empty MAC address specified" ;;
|
||||||
"You set an empty MAC address string" ;;
|
|
||||||
*) $err "Unrecognised inject mode: '$2'"
|
*) $err "Unrecognised inject mode: '$2'"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# allow the user to skip setting MAC addresses.
|
|
||||||
# if new_mac is empty, this script skips running nvmutil
|
|
||||||
[ "$new_mac" = "keep" ] && new_mac=""
|
[ "$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" || \
|
check_release "$archive" || \
|
||||||
$err "You must run this script on a release archive. - $dontflash"
|
$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 '%s' doesn't use vendorfiles, so none were inserted.\n" \
|
||||||
"$board"
|
"$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" ] && \
|
if [ "$xchanged" != "y" ] && [ "$need_files" = "y" ] && \
|
||||||
[ "$nukemode" = "nuke" ] && [ "$has_hashes" != "y" ]; then
|
[ "$nukemode" = "nuke" ] && [ "$has_hashes" != "y" ]; then
|
||||||
printf "FAILED NUKE: tarball '$archive', board '$board'\n" 1>&2
|
printf "FAILED NUKE: tarball '$archive', board '$board'\n" 1>&2
|
||||||
$err "Unhandled vendorfile deletion: DO NOT RELEASE TO RSYNC"
|
$err "Unhandled vendorfile deletion: DO NOT RELEASE TO RSYNC"
|
||||||
fi # of course, we assume that those variables are also set right
|
fi
|
||||||
|
|
||||||
err="$_olderr"
|
err="$_olderr"; :
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_release()
|
check_release()
|
||||||
|
|||||||
Reference in New Issue
Block a user