diff options
author | Leah Rowe <leah@libreboot.org> | 2025-05-02 05:54:36 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-05-05 12:18:22 +0100 |
commit | 73bd02e304b5314f4bbe5ff82a9295a99d98c70b (patch) | |
tree | 9a8b648ea526f9ab210471c71d767e2208321064 /include/lib.sh | |
parent | 87f1a8d0da9e312efd21ca727048579b1f672480 (diff) |
init.sh: move setvars/err_ to lib.sh
these functions make more sense in lib.sh
i made mk link lib.sh first, so that the
functions on init.sh can still use them.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r-- | include/lib.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/lib.sh b/include/lib.sh index 7a5f2621..853ad654 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -115,3 +115,24 @@ check_defconfig() [ -f "$x" ] && printf "%s\n" "$x" && return 1 done; : } + +setvars() +{ + _setvars="" + if [ $# -lt 2 ]; then + printf "\$err \"setvars: too few args\\n\"" + return 0 + fi + val="$1" + shift 1 + for var in "$@"; do + _setvars="$var=\"$val\"; $_setvars" + done + printf "%s\n" "${_setvars% }" +} + +err_() +{ + printf "ERROR %s: %s\n" "$0" "$1" 1>&2 + exit 1 +} |