diff options
author | Alper Nebi Yasak <alpernebiyasak@gmail.com> | 2022-08-27 15:27:48 +0300 |
---|---|---|
committer | Alper Nebi Yasak <alpernebiyasak@gmail.com> | 2022-08-27 17:35:55 +0300 |
commit | ef39e05bb5df505774b42a8739c3e7e57d43dd36 (patch) | |
tree | 52a54f8199b96ce0a098f0f079109024b6f15b41 /download | |
parent | 764a439a8cbad7d55455494f025f3e77c9fa52c0 (diff) |
download: Allow keeping .git dirs with NODELETE=git
Keeping the git repositories is useful while development, e.g. to avoid
git cloning repositories over and over again while debugging download
scripts. Setting the NODELETE environment variable keeps the blobs and
the git repositories. Allow a slightly finer-tuned version of this where
we can keep only the git-related files by setting the variable to "git".
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'download')
-rwxr-xr-x | download | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -6,6 +6,7 @@ # Copyright (C) 2015 Patrick "P. J." McDermott <pj@pehjota.net> # Copyright (C) 2015, 2016 Klemens Nanni <contact@autoboot.org> # Copyright (C) 2022, Caleb La Grange <thonkpeasant@protonmail.com> +# Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,8 +32,12 @@ set -u -e # set this when you want to modify each coreboot tree # for example, you want to test custom patches # NODELETE= ./download coreboot +deletegit="true" deleteblobs="true" -[ "x${NODELETE+set}" = 'xset' ] && deleteblobs="false" +if [ "x${NODELETE+set}" = 'xset' ]; then + [ "x${NODELETE:-all}" = "xgit" ] && deletegit="false" + [ "x${NODELETE:-all}" = "xall" ] && deleteblobs="false" && deletegit="false" +fi rm -f "build_error" @@ -89,6 +94,8 @@ if [ "${program}" = "all" ]; then if [ -f "${downloadProgram}" ]; then if [ "${deleteblobs}" = "false" ]; then NODELETE= "${downloadProgram}" + elif [ "${deletegit}" = "false" ]; then + NODELETE=git "${downloadProgram}" else "${downloadProgram}" fi @@ -103,12 +110,16 @@ fi if [ $# -lt 1 ]; then if [ "${deleteblobs}" = "false" ]; then NODELETE= "${download}/${program}" + elif [ "${deletegit}" = "false" ]; then + NODELETE=git "${download}/${program}" else "${download}/${program}" fi else if [ "${deleteblobs}" = "false" ]; then NODELETE= "${download}/${program}" $@ + elif [ "${deletegit}" = "false" ]; then + NODELETE=git "${download}/${program}" $@ else "${download}/${program}" $@ fi |