diff options
author | Leah Rowe <leah@libreboot.org> | 2025-04-18 02:16:21 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-04-18 02:17:53 +0100 |
commit | a2898771f6e3950cca9f6ba0e6510e06064d6256 (patch) | |
tree | 19bddef2b69f44c2c075435c65afa48c036bd96c | |
parent | 779f6003421ab939f0c7227940f39da9c7787997 (diff) |
lib.sh: perform root check even earlier
initialising variables, setting PWD, setting version,
this is all unnecessary before the root check, because
the dependencies commands use none of these.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | include/lib.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/lib.sh b/include/lib.sh index 7f8adcc6..21066ecc 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -79,16 +79,9 @@ install_packages() printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : } -xbmkpwd="`pwd`" || $err "Cannot generate PWD" -export PWD="$xbmkpwd" - eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version relname xbmktmp`" -for fv in version versiondate; do - eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :" -done - if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then install_packages "$@" || exit 1 exit 0 @@ -97,6 +90,13 @@ 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" +xbmkpwd="`pwd`" || $err "Cannot generate PWD" +export PWD="$xbmkpwd" + +for fv in version versiondate; do + eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :" +done + pyver="2" python="python3" command -v python3 1>/dev/null || python="python" |