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>
master
Leah Rowe 2024-12-24 12:37:33 +00:00
parent a8b35c88cf
commit ee8f53b96f
1 changed files with 4 additions and 1 deletions

View File

@ -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"