summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-23 12:34:26 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-23 12:34:26 +0100
commitd5baaff0ec66a49ad3305a7f3d06ef4280fa00e0 (patch)
tree4a5684674573fbe6d1562f712c074bc950d523a3
parent0158a081110115f501bf648e99ae7a173d921403 (diff)
lib.sh: fix error running ./build dependencies
the e() and setvars() functions need to be declared before the dependencies function. also: after calling install_packages, it was doing a return when it should have done an exit. this is all fixed now. i apologise to anyone who previously ran into trouble with this! Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xinclude/lib.sh48
1 files changed, 24 insertions, 24 deletions
diff --git a/include/lib.sh b/include/lib.sh
index c62bf98f..e4e33f0a 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -48,6 +48,29 @@ eval `setvars "" xbmk_release tmpdir _nogit version board boarddir relname \
read -r projectname < projectname || :
read -r projectsite < projectsite || :
+setcfg()
+{
+ if [ $# -gt 1 ]; then
+ printf "e \"%s\" f missing && return %s;\n" "$1" "$2"
+ else
+ printf "e \"%s\" f missing && %s \"Missing config\";\n" "$1" \
+ "$err"
+ fi
+ printf ". \"%s\" || %s \"Could not read config\";\n" "$1" "$err"
+}
+
+e()
+{
+ es_t="e"
+ [ $# -gt 1 ] && es_t="$2"
+ es2="already exists"
+ estr="[ -$es_t \"\$1\" ] || return 1"
+ [ $# -gt 2 ] && estr="[ -$es_t \"\$1\" ] && return 1" && es2="missing"
+
+ eval "$estr"
+ printf "%s %s\n" "$1" "$es2" 1>&2
+}
+
install_packages()
{
[ $# -lt 2 ] && $err "fewer than two arguments"
@@ -58,7 +81,7 @@ install_packages()
[ -n "$aur_notice" ] && \
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
}
-[ $# -gt 0 ] && [ "$1" = "dependencies" ] && install_packages $@ && return 0
+[ $# -gt 0 ] && [ "$1" = "dependencies" ] && install_packages $@ && exit 0
id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)"
[ "$(id -u)" != "0" ] || $err "this command as root is not permitted"
@@ -172,18 +195,6 @@ rmgit()
) || $err "Cannot remove .git/.gitmodules in $1"
}
-e()
-{
- es_t="e"
- [ $# -gt 1 ] && es_t="$2"
- es2="already exists"
- estr="[ -$es_t \"\$1\" ] || return 1"
- [ $# -gt 2 ] && estr="[ -$es_t \"\$1\" ] && return 1" && es2="missing"
-
- eval "$estr"
- printf "%s %s\n" "$1" "$es2" 1>&2
-}
-
# return 0 if project is single-tree, otherwise 1
# e.g. coreboot is multi-tree, so 1
singletree()
@@ -223,14 +234,3 @@ cbfs()
lzma="-c lzma" && [ $# -gt 3 ] && lzma="-t raw"
x_ "$cbfstool" "$1" $ccmd -f "$2" -n "$3" $lzma
}
-
-setcfg()
-{
- if [ $# -gt 1 ]; then
- printf "e \"%s\" f missing && return %s;\n" "$1" "$2"
- else
- printf "e \"%s\" f missing && %s \"Missing config\";\n" "$1" \
- "$err"
- fi
- printf ". \"%s\" || %s \"Could not read config\";\n" "$1" "$err"
-}