summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-01-02 23:52:45 +0000
committerLeah Rowe <leah@libreboot.org>2025-01-02 23:52:45 +0000
commit0cf58c22734b19293f4cbef83add59b031ca1773 (patch)
tree484a35f40cbf8fb400d0901c3cbd3baf22088bff /include/lib.sh
parent8276560cc998e8eb1f935cbbe7551d2fbdc65d39 (diff)
fix lbmk shellcheck errors
There was also a condition in run_make_command that is now an OR, where it was an AND, on script/trees, to fix the use of mixed (and erroneous) OR/AND operators. I'm planning a much more invasive audit than this. These are light fixes, intended for Libreboot 20241206 rev8. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 5a32d592..790f4fe9 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -33,23 +33,23 @@ err_()
setvars()
{
_setvars="" && [ $# -lt 2 ] && $err "setvars: too few arguments"
- val="$1" && shift 1 && for var in $@; do
+ val="$1" && shift 1 && for var in "$@"; do
_setvars="$var=\"$val\"; $_setvars"
done; printf "%s\n" "${_setvars% }"
}
chkvars()
{
- for var in $@; do
+ for var in "$@"; do
eval "[ -n "\${$var+x}" ] || \$err \"$var unset\""
eval "[ -n "\$$var" ] || \$err \"$var unset\""
done; return 0
}
-eval `setvars "" _nogit board xbmk_parent versiondate projectsite projectname \
- aur_notice configdir datadir version relname reinstall`
+eval "`setvars "" _nogit board reinstall versiondate projectsite projectname \
+ aur_notice configdir datadir version relname xbmk_parent`"
for fv in projectname projectsite version versiondate; do
- eval "[ ! -f "$fv" ] || read -r $fv < \"$fv\" || :"
+ eval "[ ! -f \"$fv\" ] || read -r $fv < \"$fv\" || :"
done; chkvars projectname projectsite
setcfg()
@@ -75,12 +75,13 @@ install_packages()
[ $# -lt 2 ] && $err "fewer than two arguments"
[ $# -gt 2 ] && reinstall="$3"
- eval `setcfg "config/dependencies/$2"`
+ eval "`setcfg "config/dependencies/$2"`"
+ chkvars pkg_add pkglist
$pkg_add $pkglist || $err "Cannot install packages"
[ -n "$aur_notice" ] && \
- printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
+ printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :
}
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
install_packages "$@" || exit 1
@@ -267,7 +268,7 @@ cbfs()
mk()
{
mk_flag="$1" || $err "No argument given"
- shift 1 && for mk_arg in $@; do
+ shift 1 && for mk_arg in "$@"; do
./mk $mk_flag $mk_arg || $err "./mk $mk_flag $mk_arg"; :
done; :
}