From 81034c833ef5cac7716eeb69f712002f3d99f9cf Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Wed, 18 Aug 2010 21:43:07 -0700 Subject: [PATCH] Added init script (symlinks confis in home dir) --- init.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 init.sh diff --git a/init.sh b/init.sh new file mode 100644 index 0000000..0719995 --- /dev/null +++ b/init.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +BASENAME="${0##*/}" + +if [ x"$1" != x ]; then + CONFIG_PATH="$1" +else + CONFIG_PATH="$HOME/config" +fi + +for FILE in $CONFIG_PATH/*; do + DOTFILE=".${FILE##*/}" + if [ "$DOTFILE" = ".${BASENAME}" ]; then continue; fi + if [ -e "$DOTFILE" ]; then + mkdir original-dot-files >/dev/null 2>/dev/null + echo "Existing file found at $DOTFILE, moving to ~/original-dot-files." + mv "$DOTFILE" original-dot-files/ + fi + ln -s "$FILE" "$DOTFILE" +done