summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-05 11:07:53 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-05 11:07:53 +0100
commit75382a4126f1994dd9ff1009ac084369d2b80d13 (patch)
tree8974a85b0afd7a9d4a7a7a6eac7f38b64d305259
parentc6aff76931cb3fb2694676ab360cb165967883c0 (diff)
bugfix: move dependencies handling to lib.sh
do it strategically, in just the right place so that the version and versiondate files aren't written. otherwise, version/versiondate are written as root and the build system becomes unusable after that, unless you reset the file ownerships from root. hardly user-friendly. mitigate this bug. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xbuild15
-rwxr-xr-xinclude/lib.sh21
2 files changed, 19 insertions, 17 deletions
diff --git a/build b/build
index 10982423..1fdc69c4 100755
--- a/build
+++ b/build
@@ -16,7 +16,7 @@ fi
. "include/vendor.sh"
. "include/mrc.sh"
-eval "$(setvars "" aur_notice vdir src_dirname srcdir _xm mode xp)"
+eval "$(setvars "" vdir src_dirname srcdir _xm mode xp)"
err="fail"
linkpath="${0}"
@@ -28,8 +28,6 @@ main()
[ $# -lt 1 ] && badcmd
spath="script/$1"
- [ "$1" = "dependencies" ] && x_ install_packages $@ && return 0
-
[ "$(id -u)" != "0" ] || $err "this command as root is not permitted"
for g in "which git" "git config --global user.name" \
@@ -49,17 +47,6 @@ main()
set -u -e # some commands disable them. turn them on!
}
-install_packages()
-{
- [ $# -lt 2 ] && badcmd "fewer than two arguments"
- [ -f "config/dependencies/$2" ] || badcmd "unsupported target"
-
- . "config/dependencies/$2"
-
- x_ $pkg_add $pkglist && [ -n "$aur_notice" ] && \
- printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
-}
-
git_init()
{
[ -L ".git" ] && return 1
diff --git a/include/lib.sh b/include/lib.sh
index 8868975b..c5bd4bc9 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -40,9 +40,26 @@ setvars()
done
printf "%s\n" "${_setvars% }"
}
+
eval "$(setvars "" xbmk_release tmpdir _nogit version board boarddir relname \
- versiondate threads projectname projectsite)"
+ versiondate threads projectname projectsite aur_notice)"
+
+read -r projectname < projectname || :
+read -r projectsite < projectsite || :
+
+install_packages()
+{
+ [ $# -lt 2 ] && badcmd "fewer than two arguments"
+ [ -f "config/dependencies/$2" ] || badcmd "unsupported target"
+ . "config/dependencies/$2" || $err "! . config/dependencies/$2"
+
+ $pkg_add $pkglist || $err "Cannot install packages"
+
+ [ -n "$aur_notice" ] && \
+ printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; return 0
+}
+[ $# -gt 0 ] && [ "$1" = "dependencies" ] && install_packages $@ && return 0
# 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)
@@ -80,8 +97,6 @@ x_() {
[ -e ".git" ] || [ -f "versiondate" ] || printf "1716415872\n" > versiondate || \
$err "Cannot generate unknown versiondate file"
-read -r projectname < projectname || :
-read -r projectsite < projectsite || :
[ ! -f version ] || read -r version < version || :
version_="$version"
[ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \