move git_init to the main build script

also, don't use x_ because it totally b0rks on
these commands. handle exit status directly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-10-20 21:10:26 +01:00
parent c7e764a3f0
commit e90bffff3c
2 changed files with 17 additions and 15 deletions

18
build
View File

@ -46,7 +46,7 @@ main()
check_git
check_project "fail"
git_init xx_ fail
git_init
execute_command $@
lbmk_exit 0
@ -81,6 +81,22 @@ install_packages()
printf "You must install AUR packages: %s\n" "${aur_notice}" 1>&2
}
# release archives contain .gitignore, but not .git.
# lbmk can be run from lbmk.git, or an archive.
git_init()
{
[ -L ".git" ] && fail "Reference .git is a symlink"
[ -e ".git" ] && return 0
eval "$(setvars "$(date -Rd @${versiondate})" cdate _nogit)"
git init || fail "${PWD}: cannot initialise Git repository"
git add -A . || fail "${PWD}: cannot add files to Git repository"
git commit -m "${projectname} ${version}" --date "${cdate}" || \
fail "${PWD}: can't commit ${projectname}/${version}, date ${cdate}"
git tag -a "${version}" -m "${projectname} ${version}" || \
fail "${PWD}: cannot git-tag ${projectname}/${version}"
}
execute_command()
{
lbmkcmd="${buildpath}/${option}"

View File

@ -27,20 +27,6 @@ check_git()
git_err "git config --global user.email \"john.doe@example.com\""
}
# release archives contain .gitignore, but not .git.
# lbmk can be run from lbmk.git, or an archive.
git_init()
{
[ -L ".git" ] && ${2} "Reference .git is a symlink"
[ -e ".git" ] && return 0
eval "$(setvars "$(date -Rd @${versiondate})" cdate _nogit)"
${1} git init
${1} git add -A .
${1} git commit -m "${projectname} ${version}" --date "${cdate}"
${1} git tag -a "${version}" -m "${projectname} ${version}"
}
git_err()
{
printf "You need to set git name/email, like so:\n%s\n\n" "${1}" 1>&2