summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-05 11:11:01 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-05 11:11:01 +0100
commit62c25ac7ab2b7be8e2f3a2321e44dcf93dc9c635 (patch)
tree60e4e4d0cbab5aee90616f7520dd38915c85c04d /include
parent75382a4126f1994dd9ff1009ac084369d2b80d13 (diff)
move root check to lib.sh (bugfix)
this avoids writing the version/versiondate files as root. this complements the previous fix, that avoided writing those same files when running the dependencies command. initial setup of the build system requires root, to run the dependencies script, but otherwise the build system prevents running as root for everything else, so we must avoid writing the version/versiondate files as root. that same avoidance is necessary when checking whether running other commands as root; ironically, this check then prevented running the build system at all! the bug should be fully fixed now. i found this quite by accident the other day, when testing something else. good thing this got fixed because the release! Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rwxr-xr-xinclude/lib.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/lib.sh b/include/lib.sh
index c5bd4bc9..23dfe81a 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -61,6 +61,8 @@ install_packages()
}
[ $# -gt 0 ] && [ "$1" = "dependencies" ] && install_packages $@ && return 0
+[ "$(id -u)" != "0" ] || $err "this command as root is not permitted"
+
# if "y": a coreboot target won't be built if target.cfg says release="n"
# (this is used to exclude certain build targets from releases)