X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=install-symlinks.sh;h=820d5b3ee33281c00934ffa75149c7a928195aac;hb=378960d9bed5d9276d1e6d3ef29d4cd2a81d7d57;hp=de4ef11958a6caaf76a6901632df22963fbae967;hpb=e171b2dd4d48cde23c502bfb446c6fb6dd22d88f;p=cmccabe-etc diff --git a/install-symlinks.sh b/install-symlinks.sh index de4ef11..820d5b3 100755 --- a/install-symlinks.sh +++ b/install-symlinks.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # install-symlinks.sh @@ -15,25 +15,20 @@ 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 +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 -fi +done BASEDIR=`pwd` for file in ${BASEDIR}/.[^.]*; do @@ -46,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 @@ -66,4 +62,6 @@ 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