mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-20 05:30:25 +02:00
4ebede5b99
this solves a bug that does not yet manifest, because this bug *can't* currently trigger any error due to lbmk's design. this is therefore a preventative fix, for reasons that will become clear. we previously put arguments in a variable, in a way that didn't handle globbing. now we avoid a variable and use "$@" instead, which solves the problem. this also means that the main logic in mk can be cleaner, as trees-specific control logic is now placed entirely in tree.sh's main. this means that we can now also wrap x_ around trees() this was never a problem in the past, because all of the arguments for trees commands never have globbing; config names are always e.g. foo_bar, not foo bar in commands where globbing did need to be handled, those commands were never trees commands. e.g. you had ./mk inject filename yes, this is a design improvement, or a preventative bug fix. pick your poison. Signed-off-by: Leah Rowe <leah@libreboot.org>
47 lines
1.1 KiB
Bash
Executable File
47 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
|
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
|
|
|
set -u -e
|
|
|
|
eval "`printf "LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE \
|
|
LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
|
|
LC_MEASUREMENT LC_IDENTIFICATION LC_ALL\n" | \
|
|
awk '{ for (i=1; i<=NF; i++) $i = "export " $i "=C.UTF-8;"; print }'`"
|
|
|
|
(
|
|
xbarg0="$0"
|
|
[ "${xbarg0##*/}" = "$xbarg0" ] && \
|
|
xbarg0="`command -v "$xbarg0"`"
|
|
|
|
commandv="`readlink -f "$xbarg0" 2>/dev/null`"
|
|
[ -z "$commandv" ] && \
|
|
commandv="`realpath "$xbarg0" 2>/dev/null`"
|
|
|
|
cd "${commandv%/*}" || exit 1
|
|
|
|
. "include/lib.sh"
|
|
. "include/env/init.sh"
|
|
. "include/env/get.sh"
|
|
|
|
. "include/fw/vendor.sh"
|
|
. "include/fw/mrc.sh"
|
|
. "include/fw/inject.sh"
|
|
. "include/fw/rom.sh"
|
|
|
|
. "include/mk/tree.sh"
|
|
. "include/mk/release.sh"
|
|
|
|
_f="${1-}"
|
|
shift 1 2>/dev/null || :
|
|
|
|
eval "$(printf "version release download inject\n" | awk '{ for (i=1; i<=NF; \
|
|
i++) $i = "[ \""$i"\" = \"$_f\" ] && x_ "$i" \"$@\" && exit 0;"; print }')"
|
|
|
|
x_ trees "$_f" "$@"
|
|
|
|
) || exit 1; :
|