summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-01-12 21:35:23 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-01-12 21:35:23 (GMT)
commit83f0bec91502b303ee769bac4f2717eb122bb363 (patch)
treedabb4257ecce0491ebdf1d626d24e026a0195157 /scripts
parent25c6b869cf409f5a091690f0f2ed13b78884e205 (diff)
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(-)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/crosstool.sh21
-rw-r--r--scripts/functions7
2 files changed, 17 insertions, 11 deletions
diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh
index a470e55..dd1156f 100755
--- a/scripts/crosstool.sh
+++ b/scripts/crosstool.sh
@@ -141,7 +141,7 @@ CT_DoLog EXTRA "Preparing working directories"
# 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 @@ if [ -z "${CT_RESTART}" ]; then
# 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 [ -z "${CT_RESTART}" ]; then
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 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
# 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 --git a/scripts/functions b/scripts/functions
index c68654c..5bf6b3d 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -242,6 +242,13 @@ CT_MktempDir() {
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