X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=install-symlinks.sh;h=dcaecf60da701057b7feddaf62873157747aba1e;hb=22d2f52e5262d5ef553f6a0dcffd7a4d1281e5c0;hp=d381326bc98d371fe026788dbd2d6183025a7773;hpb=3260ef8a602bb8deaff9fffc4fa5a40f6417c8f9;p=cmccabe-etc diff --git a/install-symlinks.sh b/install-symlinks.sh index d381326..dcaecf6 100755 --- a/install-symlinks.sh +++ b/install-symlinks.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # install-symlinks.sh @@ -15,6 +15,21 @@ die() { exit 1 } +copy_ssh_old=0 +for file in .bashrc .ssh .profile; do + if [ -f ../$file ]; then + if [ -L ../$file ]; then + : + else + echo "moving old $file to $file-old" + mv -f ../$file ../$file-old + if [ $file == .ssh ]; then + copy_ssh_old=1 + fi + fi + fi +done + BASEDIR=`pwd` for file in ${BASEDIR}/.[^.]*; do # get base file name, like ".gitconfig" @@ -24,9 +39,8 @@ for file in ${BASEDIR}/.[^.]*; do relfile=`echo ${file} | sed 's_.*/\([^/]*/[^/]*\)$_\1_'` # skip files which we don't want to link - if [ "${basefile}" == ".git" ]; then - continue; - fi + [ "${basefile}" == ".git" ] && continue + [ "${basefile}" == ".gitignore" ] && continue pushd .. > /dev/null if [ -L ${basefile} ]; then @@ -43,3 +57,10 @@ 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 + echo "chmod 600 ../.ssh/config" + chmod 600 ../.ssh/* +fi