summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-24 12:37:33 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-24 12:39:05 +0000
commitee8f53b96ff8bf756af1143ed0c0163a0650774c (patch)
tree7e2d614a2bcb793e7119d32588b235dfefbbfdf1 /include/lib.sh
parenta8b35c88cf132aab6704c3babbc109de4f7cc520 (diff)
lib.sh: Safer exit from ./mk dependencies
The exit was dependent upon install_packages returning zero status, which it always would in practise, due to its design, but this exit must always be observed, so the code has been modified to honour this design. A direct exit violates lbmk's design in most instances, where a temporary directory and lock file has already been created; at this stage, no such act was performed, so a direct exit is perfectly acceptable. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/lib.sh b/include/lib.sh
index e439ef8b..c765f6b8 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -69,7 +69,10 @@ install_packages()
[ -n "$aur_notice" ] && \
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
}
-[ $# -gt 0 ] && [ "$1" = "dependencies" ] && install_packages $@ && exit 0
+if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
+ install_packages $@ || exit 1
+ exit 0
+fi
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"