release.sh: Don't install git if already present

Prior to this commit, we install git from ports if there is a ports
tree available and git is not installed, and we install git from pkg
otherwise -- including the case where git is already installed.

Rework the logic to not (re)install git at all if it is already
installed.

MFC after:	3 days
This commit is contained in:
Colin Percival 2024-03-29 00:10:50 -07:00
parent 3f2b960775
commit 6baddb6b11

View File

@ -252,11 +252,11 @@ extra_chroot_setup() {
cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF}
fi
if [ -z "${NOGIT}" ]; then
# Install git from ports or packages if the ports tree is
# available and VCSCMD is unset.
_gitcmd="$(which git)"
if [ -d ${CHROOTDIR}/usr/ports -a -z "${_gitcmd}" ]; then
_gitcmd="$(which git)"
if [ -z "${NOGIT}" -a -z "${_gitcmd}" ]; then
# Install git from ports if the ports tree is available;
# otherwise install the pkg.
if [ -d ${CHROOTDIR}/usr/ports ]; then
# Trick the ports 'run-autotools-fixup' target to do the right
# thing.
_OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)