summaryrefslogtreecommitdiff
path: root/gitclone
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-18 13:03:28 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-18 13:03:28 +0100
commit1e8f2cc170015240a5278de991ad9cce27d5fe4a (patch)
treee0f21fb3518d6a98b5d12c792a23fd88cbf46033 /gitclone
parent3da8d20cd6b5e7e9338d16ce82edca20ede65585 (diff)
gitclone: only rm the old directory at the end
this way, it will only be deleted after the new git clone and patching worked successfully Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'gitclone')
-rwxr-xr-xgitclone9
1 files changed, 4 insertions, 5 deletions
diff --git a/gitclone b/gitclone
index 4630cc6e..347254c8 100755
--- a/gitclone
+++ b/gitclone
@@ -67,11 +67,6 @@ clone_project()
{
tmp_dir=$(mktemp -dt "${name}_XXXXX")
- # clean out old version just in case
- if [ -d "${location}" ]; then
- rm -rf ${location} || exit 1
- fi
-
git clone ${url} ${tmp_dir} || git clone ${bkup_url} ${tmp_dir} \
|| err "ERROR: could not download ${name}"
@@ -81,6 +76,10 @@ clone_project()
)
patch_project
+
+ if [ -d "${location}" ]; then
+ rm -Rf ${location} || exit 1
+ fi
mv ${tmp_dir} ${location} && return 0
printf "ERROR: Could not copy temp file to destination.\n"