summaryrefslogtreecommitdiff
path: root/nuttx/tools
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-08 23:55:02 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-08 23:55:02 +0000
commit9efc8450ed3a65bd5216972c013be620444d3d50 (patch)
tree5bda656e7e5f9a95dc0d73320b7b22584d8e10ef /nuttx/tools
parentbfeb1e08dd6726d78ae23a5dd01109f1fb6d5f82 (diff)
downloadpx4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.tar.gz
px4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.tar.bz2
px4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.zip
Need to handle paths with spaces in them
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@532 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/tools')
-rwxr-xr-xnuttx/tools/link.sh27
-rwxr-xr-xnuttx/tools/winlink.sh27
2 files changed, 30 insertions, 24 deletions
diff --git a/nuttx/tools/link.sh b/nuttx/tools/link.sh
index 5c9576294..ef41b3314 100755
--- a/nuttx/tools/link.sh
+++ b/nuttx/tools/link.sh
@@ -33,6 +33,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
+set -x
src=$1
dest=$2
@@ -44,23 +45,25 @@ if [ -z "${src}" -o -z "${dest}" ]; then
exit 1
fi
-# Check if something already exists at the destination path
+# Check if something already exists at the destination path replace it with
+# the new link (which might be different). Note that we check for the
+# the link (-h) before we check for existence (-e) because a bad link will
+# report that it does not exist.
-if [ -e "${dest}" ]; then
+if [ -h "${dest}" ]; then
+ rm -f "${dest}"
+else
- # Yes, is it a symbolic link? If so, then remove it so that we can
- # replace it with the new link (which might be different)
+ # If the path exists and is a directory that contains the "fake link"
+ # mark, then treat it like a soft link (i.e., remove the directory)
- if [ -h "${dest}" ]; then
- rm -f "${dest}"
+ if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
+ rm -rf "${dest}"
else
- # If the path is a directory and contains the "fake link" mark, then
- # treat it like a soft link (i.e., remove the directory)
+ # Does anything exist at the destination path?
- if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
- rm -rf "${dest}"
- else
+ if [ -e "${dest}" ]; then
# It is something else (like a file) or directory that does
# not contain the "fake link" mark
@@ -73,7 +76,7 @@ fi
# Verify that a directory exists at the source path
-if [ ! -d ${src} ]; then
+if [ ! -d "${src}" ]; then
echo "No directory at ${src}"
exit 1
fi
diff --git a/nuttx/tools/winlink.sh b/nuttx/tools/winlink.sh
index c98efa47d..272fb9636 100755
--- a/nuttx/tools/winlink.sh
+++ b/nuttx/tools/winlink.sh
@@ -55,23 +55,25 @@ if [ -z "${src}" -o -z "${dest}" ]; then
exit 1
fi
-# Check if something already exists at the destination path
+# Check if something already exists at the destination path replace it with
+# the new link (which might be different). Note that we check for the
+# the link (-h) before we check for existence (-e) because a bad link will
+# report that it does not exist.
-if [ -e "${dest}" ]; then
+if [ -h "${dest}" ]; then
+ rm -f "${dest}"
+else
- # Yes, is it a symbolic link? If so, then remove it so that we can
- # replace it with the new directory copy
+ # If the path exists and is a directory that contains the "fake link"
+ # mark, then treat it like a soft link (i.e., remove the directory)
- if [ -h "${dest}" ]; then
- rm -f "${dest}"
+ if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
+ rm -rf "${dest}"
else
- # If the path is a directory and contains the "fake link" mark, then
- # remove the directory so that we can replace it with a new copy
+ # Does anything exist at the destination path?
- if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then
- rm -rf "${dest}"
- else
+ if [ -e "${dest}" ]; then
# It is something else (like a file) or directory that does
# not contain the "fake link" mark
@@ -82,9 +84,10 @@ if [ -e "${dest}" ]; then
fi
fi
+
# Verify that a directory exists at the source path
-if [ ! -d ${src} ]; then
+if [ ! -d "${src}" ]; then
echo "No directory at ${src}"
exit 1
fi