diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-11-30 20:34:50 (GMT) |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-11-30 20:34:50 (GMT) |
commit | 009eb2a247593b36c98594464ed305c97af9a731 (patch) | |
tree | a4632a42b704cb3ed70cac4b8afe395700482018 /scripts/functions | |
parent | 01a58679df10cde9524e0f4170fed51363df1fb2 (diff) |
scripts: protect against partially extracted source
In case of failure (eg. user hitting Ctrl-C), avoid extracting over
partially extracted source. Will help once we have git available.
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions index b4d0375..c8fec30 100644 --- a/scripts/functions +++ b/scripts/functions @@ -577,6 +577,16 @@ CT_Extract() { fi local full_file="${CT_TARBALLS_DIR}/${basename}${ext}" + # Check if previously partially extracted + if [ -e "${CT_SRC_DIR}/.${basename}.extracting" ]; then + CT_DoLog ERROR "The '${basename}' sources were partially extracted." + CT_DoLog ERROR "Please remove first:" + CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracting'" + CT_Abort "I'll stop now to avoid any carnage..." + fi + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting" + # Check if already extracted if [ -e "${CT_SRC_DIR}/.${basename}.extracted" ]; then CT_DoLog DEBUG "Already extracted '${basename}'" @@ -599,6 +609,7 @@ CT_Extract() { CT_DoExecLog DEBUG chmod -R u+w "${CT_SRC_DIR}" CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted" + CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting" [ "${nochdir}" = "nochdir" ] || CT_Popd } |