# HG changeset patch # User "Yann E. MORIN" # Date 1231796123 0 # Node ID ae135a73e3383e5f06ce65f5fcec63f86abe2f39 # Parent 4a8b036e4bc254068c7a899a986495d84ce50fc7 Fix removing existing directories by chmod'ing them to be user-writeable. /trunk/scripts/crosstool.sh | 21 10 11 0 ++++++++++----------- /trunk/scripts/functions | 7 7 0 0 +++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff -r 4a8b036e4bc2 -r ae135a73e338 scripts/crosstool.sh --- a/scripts/crosstool.sh Mon Jan 12 21:34:11 2009 +0000 +++ b/scripts/crosstool.sh Mon Jan 12 21:35:23 2009 +0000 @@ -141,7 +141,7 @@ # Ah! The build directory shall be eradicated, even if we restart! if [ -d "${CT_BUILD_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_BUILD_DIR}" + CT_DoForceRmdir "${CT_BUILD_DIR}" fi # Don't eradicate directories if we need to restart @@ -150,20 +150,20 @@ # We need to do that _before_ we can safely log, because the log file will # most probably be in the toolchain directory. if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_TARBALLS_DIR}" + CT_DoForceRmdir "${CT_TARBALLS_DIR}" fi if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_SRC_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_SRC_DIR}" + CT_DoForceRmdir "${CT_SRC_DIR}" fi if [ -d "${CT_INSTALL_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_INSTALL_DIR}" + CT_DoForceRmdir "${CT_INSTALL_DIR}" fi if [ -d "${CT_DEBUG_INSTALL_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_DEBUG_INSTALL_DIR}" + CT_DoForceRmdir "${CT_DEBUG_INSTALL_DIR}" fi # In case we start anew, get rid of the previously saved state directory if [ -d "${CT_STATE_DIR}" ]; then - CT_DoExecLog ALL rm -rf "${CT_STATE_DIR}" + CT_DoForceRmdir "${CT_STATE_DIR}" fi fi @@ -408,8 +408,7 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" ]; then if [ "${CT_FORCE_EXTRACT}" = "y" ]; then - mv "${CT_SRC_DIR}" "${CT_SRC_DIR}.force.$$" - CT_DoExecLog ALL rm -rf "${CT_SRC_DIR}.force.$$" + CT_DoForceRmdir "${CT_SRC_DIR}" CT_DoExecLog ALL mkdir -p "${CT_SRC_DIR}" fi CT_DoStep INFO "Extracting and patching toolchain components" @@ -491,9 +490,9 @@ # Remove the generated documentation files if [ "${CT_REMOVE_DOCS}" = "y" ]; then CT_DoLog INFO "Removing installed documentation" - CT_DoExecLog ALL rm -rf "${CT_PREFIX_DIR}/"{,usr/}{man,info} - CT_DoExecLog ALL rm -rf "${CT_SYSROOT_DIR}/"{,usr/}{man,info} - CT_DoExecLog ALL rm -rf "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info} + CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{man,info} + CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{man,info} + CT_DoForceRmdir "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info} fi fi diff -r 4a8b036e4bc2 -r ae135a73e338 scripts/functions --- a/scripts/functions Mon Jan 12 21:34:11 2009 +0000 +++ b/scripts/functions Mon Jan 12 21:35:23 2009 +0000 @@ -242,6 +242,13 @@ return 0 } +# Removes one or more directories, even if it is read-only +# Usage: CT_DoForceRmdir dir [...] +CT_DoForceRmdir() { + CT_DoExecLog ALL chmod -R u+w "${@}" + CT_DoExecLog ALL rm -rf "${@}" +} + # Echoes the specified string on stdout until the pipe breaks. # Doesn't fail # $1: string to echo