From c2178640aa2537662bb71022cb0f89c6001eecc7 Mon Sep 17 00:00:00 2001 From: Christian Koptein Date: Wed, 1 May 2024 10:50:13 +0200 Subject: [PATCH] added checks for existing files --- install.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index fe0f363..f57248c 100755 --- a/install.sh +++ b/install.sh @@ -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