X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=install-symlinks.sh;h=820d5b3ee33281c00934ffa75149c7a928195aac;hb=8271e6a6c6a16eb55d98580b027e948ea8f22fbe;hp=17e0f0a42b7259df3e1140cf2b42513b87ce50f5;hpb=93f3cc0b30f3213d791d5c613780225270017eed;p=cmccabe-etc diff --git a/install-symlinks.sh b/install-symlinks.sh index 17e0f0a..820d5b3 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" @@ -26,6 +41,7 @@ for file in ${BASEDIR}/.[^.]*; do # skip files which we don't want to link [ "${basefile}" == ".git" ] && continue [ "${basefile}" == ".gitignore" ] && continue + #[ "${basefile}" == ".ssh" ] && continue pushd .. > /dev/null if [ -L ${basefile} ]; then @@ -42,3 +58,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