From 2453c303e64b3b3c2480564106ea77d89af624d8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 16 Aug 2023 19:58:47 +0100 Subject: gitclone: always clean up /tmp in certain conditions, the tmpdir was not being deleted Signed-off-by: Leah Rowe --- gitclone | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gitclone') diff --git a/gitclone b/gitclone index bd49a04a..6bb52ef9 100755 --- a/gitclone +++ b/gitclone @@ -26,7 +26,7 @@ main() clone_project # clean in case of failure - rm -rf ${tmp_dir} >/dev/null 2>&1 || exit 1 + rm -Rf ${tmp_dir} >/dev/null 2>&1 || exit 1 } read_config() @@ -72,14 +72,14 @@ clone_project() || err "ERROR: could not download ${name}" ( - cd ${tmp_dir} || exit 1 + cd ${tmp_dir} || err "tmpdir not created" git reset --hard ${revision} || err "Cannot reset revision" ) patch_project if [ -d "${location}" ]; then - rm -Rf ${location} || exit 1 + rm -Rf ${location} || err "Cannot remove directory '${location}'" fi mv ${tmp_dir} ${location} && return 0 @@ -96,7 +96,7 @@ patch_project() continue fi ( - cd ${tmp_dir} || exit 1 + cd ${tmp_dir} || err "tmpdir not created" git am ${patchfile} || err "Cannot patch project: $name" ) done @@ -116,6 +116,7 @@ err() { printf "${@}\n" usage + rm -Rf ${tmp_dir} >/dev/null 2>&1 exit 1 } -- cgit v1.2.1