1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 21:45:10 +01:00

Better symlink checking, prefix backup dir

This commit is contained in:
Michiel Scholten
2014-08-12 13:13:01 +02:00
parent 33bd195ee2
commit c5fe2c94e6

View File

@@ -37,17 +37,16 @@ for TARGET
in .bash_aliases .bashrc bin .gitconfig .gitmodules .hgauthors.txt .hgignore .hgrc .screenrc .terminfo .tmux.conf .vim .vimrc in .bash_aliases .bashrc bin .gitconfig .gitmodules .hgauthors.txt .hgignore .hgrc .screenrc .terminfo .tmux.conf .vim .vimrc
do do
echo $TARGET echo $TARGET
if [ -L $TARGET ]; then if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then
echo "symlink exists, skipping" echo "symlink exists and is fine, skipping"
elif [ -e $TARGET ]; then elif [ -e $TARGET ]; then
echo "exists, moving" echo "exists, moving out of the way"
if [ ! -d "workspace/backup/$DATETIME" ]; then if [ ! -d "workspace/backup/$DATETIME" ]; then
mkdir -p "workspace/backup/$DATETIME" mkdir -p "workspace/backup/$DATETIME"
fi fi
#mv $TARGET "workspace/backup/$DATETIME/${TARGET}" #mv $TARGET "workspace/backup/$DATETIME/${TARGET}"
echo "workspace/backup/$DATETIME/${TARGET}" echo "workspace/backup/dotfiles_$DATETIME/${TARGET}"
fi fi
#ln -s
#ln -s $DIR/$TARGET #ln -s $DIR/$TARGET
echo "ln -s $DIR/$TARGET" echo "ln -s $DIR/$TARGET"
done done