summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitcheck81
-rwxr-xr-xcheckgit27
-rwxr-xr-xfetch1
-rwxr-xr-xfetch_trees1
-rwxr-xr-xlbmk5
-rw-r--r--resources/git/revisions5
6 files changed, 33 insertions, 87 deletions
diff --git a/.gitcheck b/.gitcheck
deleted file mode 100755
index b3405a9c..00000000
--- a/.gitcheck
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env sh
-# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
-# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
-# SPDX-License-Identifier: GPL-3.0-only
-
-. "include/err.sh"
-
-git_name="lbmkplaceholder"
-git_email="placeholder@lbmkplaceholder.com"
-
-main()
-{
- [ "$(id -u)" = "0" ] && return 0
-
- if [ $# -gt 0 ]; then
- if [ "${1}" = "clean" ]; then
- clean 1> /dev/null
- else
- err "unsupported argument, \"${1}\""
- fi
- else
- set_placeholders 1> /dev/null
- fi
-}
-
-set_placeholders()
-{
- set_git_credentials
-
- # Check coreboot as well to prevent errors during building
- [ -d coreboot ] || return 0
- for x in coreboot/*; do
- [ -d "${x}" ] || continue
- [ -e "${x}/.git" ] || continue
- (
- cd "${x}"
- set_git_credentials
- )
- done
-}
-
-set_git_credentials()
-{
- # Check if username and or email is set.
- if ! git config user.name || git config user.email ; then
- git config user.name || git config user.name "${git_name}" || \
- err "cannot set local git user.name"
- git config user.email || git config user.email "${git_email}" \
- || err "cannot set local git user.email"
- fi
-}
-
-clean()
-{
- unset_placeholders
-
- [ -d coreboot ] || return 0
- for x in coreboot/*; do
- [ -d "${x}" ] || continue
- [ -e "${x}/.git" ] || continue
- (
- cd "${x}"
- unset_placeholders
- )
- done
-}
-
-unset_placeholders()
-{
- if [ "$(git config user.name)" = "${git_name}" ]; then
- git config --unset user.name || \
- err "cannot unset local git user.name"
- fi
-
- if [ "$(git config user.email)" = "${git_email}" ]; then
- git config --unset user.email || \
- err "cannot unset local git user.email"
- fi
-}
-
-main $@
diff --git a/checkgit b/checkgit
new file mode 100755
index 00000000..eb97dcae
--- /dev/null
+++ b/checkgit
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
+# SPDX-License-Identifier: MIT
+
+. "include/err.sh"
+
+projectname="$(cat projectname)"
+
+main()
+{
+ which git 1>/dev/null 2>/dev/null || \
+ fail "git not installed. please install git-scm."
+ git config --global user.name 1>/dev/null 2>/dev/null || \
+ fail "git config --global user.name \"John Doe\""
+ git config --global user.email 1>/dev/null 2>/dev/null || \
+ fail "git config --global user.email \"john.doe@example.com\""
+}
+
+fail()
+{
+ printf "You must configure Git, before using %s's build system. Do:\n" \
+ "${projectname}" 1>&2
+ printf "%s\n\n" "${1}"
+ err "Misconfigured git-scm"
+}
+
+main $@
diff --git a/fetch b/fetch
index 5bc0e56b..bcd46af9 100755
--- a/fetch
+++ b/fetch
@@ -22,6 +22,7 @@ main()
if [ "$(id -u)" = "0" ]; then
fail "running lbmk as root as not permitted"
fi
+ ./checkgit || err "Please read: https://libreboot.org/docs/build/"
[ $# -gt 0 ] || fail "no argument given"
diff --git a/fetch_trees b/fetch_trees
index 3c33beb0..be5d4d86 100755
--- a/fetch_trees
+++ b/fetch_trees
@@ -39,6 +39,7 @@ main()
if [ "$(id -u)" = "0" ]; then
err "running lbmk as root as not permitted"
fi
+ ./checkgit || err "Please read: https://libreboot.org/docs/build/"
rm -f "${cfgsdir}"/*/seen || err_rm_seen "main 1"
diff --git a/lbmk b/lbmk
index 496d7145..0d5addc2 100755
--- a/lbmk
+++ b/lbmk
@@ -44,9 +44,10 @@ main()
err "running lbmk as root as not permitted"
fi
+ ./checkgit || err "Please read: https://libreboot.org/docs/build/"
+
buildpath="./script/${0##*/}"
- ./.gitcheck || err "/.gitcheck call from main, in /lbmk"
[ "${mode}" = "help" ] && usage ${0} && exit 0
[ "${mode}" = "list" ] && ./build command options "${buildpath}" && \
exit 0
@@ -84,8 +85,6 @@ main()
fi
"${buildpath}/${mode}/${option}" $@ || err "lbmk error"
esac
-
- ./.gitcheck clean || err "/.gitcheck clean call from main, in /lbmk"
}
install_dependencies()
diff --git a/resources/git/revisions b/resources/git/revisions
index c3a7fe72..eec8d038 100644
--- a/resources/git/revisions
+++ b/resources/git/revisions
@@ -2,9 +2,8 @@
# for various git projects used by lbmk.
# Project name is enclosed by curly braces '{}' information about the
# project relevant to lbmk is stored between the subsequent curly
-# braces. This file is used by the gitcheck script as well as the
-# fetch script. Each entry must include: revision 'rev', location
-# 'loc', and the git url 'url'. Bkup_url is optional.
+# braces. This file is used by the fetch script. Each entry must include:
+# revision 'rev', 'location', 'loc', and the git url 'url'. Optional: 'bkup_url'
{coreboot}{
rev: HEAD