From c5fe2c94e69673144a954f7387212f1b2fb24a16 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Tue, 12 Aug 2014 13:13:01 +0200 Subject: [PATCH] Better symlink checking, prefix backup dir --- install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 05a3141..3a9f4fc 100644 --- a/install.sh +++ b/install.sh @@ -37,17 +37,16 @@ for TARGET in .bash_aliases .bashrc bin .gitconfig .gitmodules .hgauthors.txt .hgignore .hgrc .screenrc .terminfo .tmux.conf .vim .vimrc do echo $TARGET - if [ -L $TARGET ]; then - echo "symlink exists, skipping" + if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then + echo "symlink exists and is fine, skipping" elif [ -e $TARGET ]; then - echo "exists, moving" + echo "exists, moving out of the way" if [ ! -d "workspace/backup/$DATETIME" ]; then mkdir -p "workspace/backup/$DATETIME" fi #mv $TARGET "workspace/backup/$DATETIME/${TARGET}" - echo "workspace/backup/$DATETIME/${TARGET}" + echo "workspace/backup/dotfiles_$DATETIME/${TARGET}" fi - #ln -s #ln -s $DIR/$TARGET echo "ln -s $DIR/$TARGET" done