lib.sh: do root check before python check

we don't need python before the root check

principle of least privilege

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.04_branch
Leah Rowe 2025-04-18 02:02:10 +01:00
parent 0fa1265106
commit 46fb5786e0
1 changed files with 3 additions and 3 deletions

View File

@ -93,6 +93,9 @@ if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
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"
pyver="2"
python="python3"
command -v python3 1>/dev/null || python="python"
@ -109,9 +112,6 @@ if [ "${pyver%%.*}" != "3" ]; then
exit 1
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"
# XBMK_CACHE is a directory, for caching downloads and git repositories
[ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache"
[ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache"