]> oss.titaniummirror.com Git - smckown/dotfiles.git/commitdiff
Add install script (sets symlinks)
authorR. Steve McKown <rsmckown@gmail.com>
Tue, 2 Jun 2015 23:16:45 +0000 (17:16 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 2 Jun 2015 23:16:45 +0000 (17:16 -0600)
install.sh [new file with mode: 0755]

diff --git a/install.sh b/install.sh
new file mode 100755 (executable)
index 0000000..252e37c
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Install symlinks to dotfiles
+
+dolink()
+{
+    src="$1"
+    target="$2"
+
+    if [ -L "$target" ]; then
+        # Target is a symlink.  Remove and recreate it just to be sure
+        echo "Relinking $src -> $target"
+        rm "$target"
+        ln -s "$src" "$target"
+    elif [ -e "$target" ]; then
+        # Target exists and is not a symlink.  Report and do not relink.
+        echo "ERROR: target $target exists and is not a symlink" >&2
+    else
+        # Target does not exist.  Create it.
+        ln -s "$src" "$target"
+        echo "Symlinking $src -> $target"
+    fi
+}
+
+cd ~
+
+dolink .dotfiles/vim .vim
+dolink .dotfiles/vimrc .vimrc