mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-22 14:36:31 +02:00
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>
This commit is contained in:
+7
-7
@@ -79,16 +79,9 @@ install_packages()
|
|||||||
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :
|
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 \
|
eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \
|
||||||
datadir version relname xbmktmp`"
|
datadir version relname xbmktmp`"
|
||||||
|
|
||||||
for fv in version versiondate; do
|
|
||||||
eval "[ ! -f \".$fv\" ] || read -r $fv < \".$fv\" || :"
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
||||||
install_packages "$@" || exit 1
|
install_packages "$@" || exit 1
|
||||||
exit 0
|
exit 0
|
||||||
@@ -97,6 +90,13 @@ fi
|
|||||||
id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)"
|
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"
|
[ "$(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"
|
pyver="2"
|
||||||
python="python3"
|
python="python3"
|
||||||
command -v python3 1>/dev/null || python="python"
|
command -v python3 1>/dev/null || python="python"
|
||||||
|
|||||||
Reference in New Issue
Block a user