From 6fd018089ce22baf5e83e6a74ece62fd533eeb8b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 11 Nov 2014 07:00:18 -0600 Subject: [PATCH] Check link target - do nothing if link is already created and the target matches the request. From Freddie Chopin. --- tools/link.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/link.sh b/tools/link.sh index da1e6e7ae5..f14e9e5abb 100755 --- a/tools/link.sh +++ b/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