diff options
author | Leah Rowe <leah@libreboot.org> | 2023-08-16 19:58:47 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-08-16 19:59:40 +0100 |
commit | 2453c303e64b3b3c2480564106ea77d89af624d8 (patch) | |
tree | efe38bced152ef4873af3790928f1717c0abbf1f /gitclone | |
parent | adeb065c5ea24ee2c9d9c11b526abf2d4ce9ce09 (diff) |
gitclone: always clean up /tmp
in certain conditions, the tmpdir was not being deleted
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'gitclone')
-rwxr-xr-x | gitclone | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 } |