aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <bobov_a@sibsac.ru>2011-10-13 11:57:57 +0600
committerAnton Bobov <bobov_a@sibsac.ru>2011-10-13 11:57:57 +0600
commita5ef66c3e779279bd92982f02579329e89f1d0b7 (patch)
tree10d767c151002fb9735fb555bd4a7ce6f6c68497
parentda709cd9e90c3ab644bb92700f0ed40d965b80d3 (diff)
Fixup.
-rwxr-xr-xclone_and_link.sh25
1 files changed, 24 insertions, 1 deletions
diff --git a/clone_and_link.sh b/clone_and_link.sh
index 9140361..94b09fa 100755
--- a/clone_and_link.sh
+++ b/clone_and_link.sh
@@ -5,9 +5,32 @@
set -e
dir=dot-files/files
+os=$(uname -o)
+
+create_windows_link()
+{
+ target=$target/$(basename "$link")
+ rm -rvf "$target"
+ if [ -d "$link" ] ; then
+ cmd /c mklink /D $(cygpath -w "$target") $(cygpath -w "$link")
+ else
+ cmd /c mklink $(cygpath -w "$target") $(cygpath -w "$link")
+ fi
+}
+
+create_link()
+{
+ local link=$1
+ local target=$2
+ case "$os" in
+ "Cygwin") create_windows_link ;;
+ *) ln --verbose --symbolic --force "$link" "$target" ;;
+ esac
+}
+
cd &&
ls --format=single-column --directory $dir/{,.}* | while read f ; do
[ "$f" == "$dir/." ] ||
[ "$f" == "$dir/.." ] ||
- ln --verbose --symbolic --force "$f" ~/test/
+ create_link "$f" .
done