added checks for existing files

This commit is contained in:
Christian Koptein 2024-05-01 10:50:13 +02:00
parent 461561964a
commit c2178640aa

View File

@ -1,14 +1,20 @@
#! /bin/bash
set -eou pipefail
mkdir -p $HOME/.ssh
for link in bashrc gitconfig screenrc Xresources Xdefaults Xmodmap themes fonts aliases vim vimrc ;do
rm -rf $HOME/.$link && ln -s $(pwd)/$link $HOME/.$link;
#remove real files if present, making room for links
if [ -f $HOME/.$link ]; then
#echo 'removing' $HOME/.$link;
rm $HOME/.$link;
fi
if [ ! -e $HOME/.$link ]; then
#echo 'linking ' $(pwd)/$link $HOME/.$link;
ln -s $(pwd)/$link $HOME/.$link;
fi
done
ln -s $(pwd)/sshconfig $HOME/.ssh/config
if [ ! -e $HOME/.$link ]; then
ln -s $(pwd)/sshconfig $HOME/.ssh/config;
fi
cat $(pwd)/pubkeys/* > $HOME/.ssh/authorized_keys