summaryrefslogtreecommitdiff
path: root/include/git.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-07-19 00:31:57 +0100
committerLeah Rowe <leah@libreboot.org>2024-07-19 00:37:11 +0100
commit2b50b3ea9a11b6ba2751ebb4237f0ea7288e5c81 (patch)
tree78272735f8a19e23c84ab720980d54d16f6244b0 /include/git.sh
parent0e0b12a630d2f4846488233cf33fe4abaa185112 (diff)
put cachedir in environmental variable
XBMK_CACHE is now used, instead of hardcoding cache/ this is exported initialised to cache/, if unset. this means you can set your own directory, and it means ./update release will use the same directory. this means bandwidth wastage is further avoided. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rw-r--r--include/git.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/git.sh b/include/git.sh
index 3a6247d0..f8441f33 100644
--- a/include/git.sh
+++ b/include/git.sh
@@ -37,7 +37,7 @@ fetch_project()
clone_project()
{
- loc="cache/repo/$project" && singletree "$project" && \
+ loc="$XBMK_CACHE/repo/$project" && singletree "$project" && \
loc="src/$project"
printf "Downloading project '%s' to '%s'\n" "$project" "$loc"
@@ -62,8 +62,9 @@ git_prep()
[ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \
[ "$xtree" != "$tree" ] && link_crossgcc "$_loc"
- [ "$XBMK_RELEASE" = "y" ] && [ "$_loc" != "cache/repo/$project" ] \
- && rmgit "$tmpgit"
+ [ "$XBMK_RELEASE" = "y" ] && \
+ [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \
+ rmgit "$tmpgit"
move_repo "$_loc"
}
@@ -106,8 +107,8 @@ tmpclone()
repofail="n"
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
- repodir="cache/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
- x_ mkdir -p "cache/repo"
+ repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
+ mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo"
if [ -d "$repodir" ] && [ $# -lt 6 ]; then
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|| sleep 3 || git -C "$repodir" pull || :