diff options
-rw-r--r-- | scripts/functions | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/scripts/functions b/scripts/functions index d753f37..787cd14 100644 --- a/scripts/functions +++ b/scripts/functions @@ -385,12 +385,11 @@ CT_GetFile() { CT_DoGetFile "${url}/${file}${ext}" if [ -f "${file}${ext}" ]; then if [ "${CT_SAVE_TARBALLS}" = "y" ]; then - # No need to test if the file already exists because - # it does NOT. If it did exist, we'd have been stopped - # above, when looking for local copies. + # The file may already exist if downloads are forced: remove it first CT_DoLog EXTRA "Saving '${file}' to local storage" - mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL - ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL + CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" + CT_DoExecLog ALL mv -f "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" + CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" fi return 0 fi @@ -406,12 +405,11 @@ CT_GetFile() { CT_DoGetFile "${url}/${file}${ext}" if [ -f "${file}${ext}" ]; then if [ "${CT_SAVE_TARBALLS}" = "y" ]; then - # No need to test if the file already exists because - # it does NOT. If it did exist, we'd have been stopped - # above, when looking for local copies. + # The file may already exist if downloads are forced: remove it first CT_DoLog EXTRA "Saving '${file}' to local storage" - mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL - ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL + CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" + CT_DoExecLog ALL mv -f "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" + CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" fi return 0 fi |