mirror of
https://github.com/aquatix/dotfiles.git
synced 2025-12-06 22:55:10 +01:00
Better symlink detection; support subdirs with links, backups
This commit is contained in:
32
install.sh
32
install.sh
@@ -36,22 +36,36 @@ cd
|
|||||||
for TARGET
|
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
|
||||||
|
cd
|
||||||
echo $TARGET
|
echo $TARGET
|
||||||
if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then
|
if [ "$(readlink $TARGET)" = "$DIR/$TARGET" ]; then
|
||||||
echo "symlink exists and is fine, skipping"
|
echo " symlink exists and is fine, skipping"
|
||||||
elif [ -e $TARGET ]; then
|
continue
|
||||||
echo "exists, moving out of the way"
|
elif [ -e $TARGET ] || [ -L $TARGET ] && [ "$(readlink $TARGET)" != "$DIR/$TARGET" ]; then
|
||||||
|
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}"
|
DIRNAME=$(dirname ${TARGET})
|
||||||
echo "workspace/backup/dotfiles_$DATETIME/${TARGET}"
|
if [ $DIRNAME != "." ]; then
|
||||||
|
mkdir "workspace/backup/$DATETIME/$DIRNAME"
|
||||||
|
mv $TARGET "workspace/backup/$DATETIME/$DIRNAME"
|
||||||
|
#echo "workspace/backup/privdotfiles_$DATETIME/$DIRNAME"
|
||||||
|
else
|
||||||
|
mv $TARGET "workspace/backup/$DATETIME/"
|
||||||
|
#echo "workspace/backup/privdotfiles_$DATETIME/${TARGET}"
|
||||||
fi
|
fi
|
||||||
#ln -s $DIR/$TARGET
|
fi
|
||||||
echo "ln -s $DIR/$TARGET"
|
|
||||||
|
# If link is in a subdir, go there
|
||||||
|
DIRNAME=$(dirname ${TARGET})
|
||||||
|
if [ $DIRNAME != "." ]; then
|
||||||
|
cd $DIRNAME
|
||||||
|
fi
|
||||||
|
# Create the symlink
|
||||||
|
ln -s $DIR/$TARGET
|
||||||
|
#echo "ln -s $DIR/$TARGET"
|
||||||
done
|
done
|
||||||
# Test
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
echo "INFO: Init submodules"
|
echo "INFO: Init submodules"
|
||||||
git submodule init
|
git submodule init
|
||||||
|
|||||||
Reference in New Issue
Block a user