mirror of
https://codeberg.org/canoeboot/cbmk.git
synced 2025-07-28 16:32:30 +01: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:
parent
dbf40653b2
commit
ec25425e55
1 changed files with 7 additions and 7 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue