summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-04 10:02:59 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-04 10:02:59 +0100
commit923a96c18eae49c2f1c0a688d0d5d059efd22614 (patch)
treeb865f431f9a72fe171f77b1501a35a16fe7d5370
parent1223bfaeefc2d49a1f522456befba11bc2a3e865 (diff)
check git/version: properly call err()
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xinclude/err.sh9
-rwxr-xr-xlbmk2
2 files changed, 6 insertions, 5 deletions
diff --git a/include/err.sh b/include/err.sh
index 8474e55b..a2780e10 100755
--- a/include/err.sh
+++ b/include/err.sh
@@ -11,7 +11,7 @@ xx_() {
check_git()
{
which git 1>/dev/null 2>/dev/null || \
- err "git not installed. please install git-scm."
+ git_err "git not installed. please install git-scm."
git config --global user.name 1>/dev/null 2>/dev/null || \
git_err "git config --global user.name \"John Doe\""
git config --global user.email 1>/dev/null 2>/dev/null || \
@@ -20,13 +20,14 @@ check_git()
git_err()
{
- printf "You need to set git name/email, like so:\n%s\n\n" "${1}"
+ printf "You need to set git name/email, like so:\n%s\n\n" "${1}" 1>&2
fail "Git name/email not configured" || \
err "Git name/email not configured"
}
check_project()
{
+ _fail="${1}"
read project < projectname
[ -f version ] && read version < version
@@ -39,8 +40,8 @@ check_project()
[ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \
--pretty='%ct' HEAD)" || versiondate="${versiondate_}"
- [ -z ${versiondate} ] && err "Unknown version date"
- [ -z ${version} ] && err "Unknown version"
+ [ -z ${versiondate} ] && "${_fail}" "Unknown version date"
+ [ -z ${version} ] && "${_fail}" "Unknown version"
printf "%s\n" "${version}" > version
printf "%s\n" "${versiondate}" > versiondate
diff --git a/lbmk b/lbmk
index 6ccf4db5..b2e97b00 100755
--- a/lbmk
+++ b/lbmk
@@ -24,7 +24,7 @@ main()
shift 2
check_git
- check_project
+ check_project "fail"
execute_command $@
lbmk_exit 0