diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-11 07:00:18 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-11 07:00:18 -0600 |
commit | 653ee19c65eeda001b3af4bfe5b15888fc124933 (patch) | |
tree | 4bb56acb940bd2bbefa08d0f1df422e3fd4472d9 /nuttx | |
parent | faeb86d7950d3f4a466c6071941534ad5d9215e5 (diff) | |
download | px4-nuttx-653ee19c65eeda001b3af4bfe5b15888fc124933.tar.gz px4-nuttx-653ee19c65eeda001b3af4bfe5b15888fc124933.tar.bz2 px4-nuttx-653ee19c65eeda001b3af4bfe5b15888fc124933.zip |
Check link target - do nothing if link is already created and the target matches the request. From Freddie Chopin.
Diffstat (limited to 'nuttx')
-rwxr-xr-x | nuttx/tools/link.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nuttx/tools/link.sh b/nuttx/tools/link.sh index da1e6e7ae..f14e9e5ab 100755 --- a/nuttx/tools/link.sh +++ b/nuttx/tools/link.sh @@ -51,6 +51,15 @@ fi # report that it does not exist. if [ -h "${dest}" ]; then + + # If the link is already created (and matches the request) do nothing + + if [ "$(readlink ${dest})" = "${src}" ]; then + exit 0 + fi + + # Otherwise, remove the link + rm -f "${dest}" else |