git.sh: fix error with cache re-download

in some cases, on a fresh clone, the cached repo already
exists but lbmk tries to download it again. work around
this by checking that the directory exists; it's in the
main if statement, so that the "else" still applies. as
a result, the fallback to a live repo would un-fall back
to doing git-pull if the cached directory exists exists.

if it doesn't seem to make sense, it's because it doesn't.
this whole function needs to be rewritten better.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2024-10-05 03:52:50 +01:00 committed by Leah Rowe
parent 018486d912
commit 4c08c390dd
1 changed files with 2 additions and 2 deletions

View File

@ -103,9 +103,9 @@ tmpclone()
repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo"
if [ "$livepull" = "y" ]; then
if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then
git clone $1 "$repodir" || git clone $2 "$repodir" || \
$err "!clone $1 $2 $repodir $4 $5"
$err "!clone $1 $2 $repodir $4 $5" #
elif [ -d "$repodir" ] && [ $# -lt 6 ]; then
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|| sleep 3 || git -C "$repodir" pull || :