From: cmccabe Date: Fri, 7 Dec 2012 19:05:26 +0000 (-0800) Subject: install-symlinks.sh: handle pre-existing stuff better X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e171b2dd4d48cde23c502bfb446c6fb6dd22d88f;hp=eeed3ab7ca37c4c4506194d1b0daffed70d75310;p=cmccabe-etc install-symlinks.sh: handle pre-existing stuff better Handle pre-existing .bashrc and .ssh better. Signed-off-by: Colin McCabe --- diff --git a/install-symlinks.sh b/install-symlinks.sh index 17e0f0a..de4ef11 100755 --- a/install-symlinks.sh +++ b/install-symlinks.sh @@ -15,6 +15,26 @@ die() { exit 1 } +if [ -f ../.bashrc ]; then + if [ -L ../.bashrc ]; then + : + else + echo "moving old .bashrc to .bashrc-old" + mv -f ../.bashrc ../.bashrc-old + fi +fi + +copy_ssh_old=0 +if [ -d ../.ssh ]; then + if [ -L ../.ssh ]; then + : + else + echo "moving old .ssh to .ssh-old" + mv -f ../.ssh ../.ssh-old + copy_ssh_old=1 + fi +fi + BASEDIR=`pwd` for file in ${BASEDIR}/.[^.]*; do # get base file name, like ".gitconfig" @@ -42,3 +62,8 @@ for file in ${BASEDIR}/.[^.]*; do fi popd > /dev/null done + +if [ $copy_ssh_old -eq 1 ]; then + echo "copying files from .ssh-old to .ssh" + cp -f ../.ssh-old/* ../.ssh +fi