annotate setup.sh @ 2:a5fc9c16087c

Add setup script to symlink files
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Jul 2013 19:57:26 +0100
parents
children 2a6d32a03c0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 #! /bin/bash
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 SCRIPTPATH=`dirname $(readlink -f $0)`
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 create_symlink() {
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 if [ ! -e $2 ]; then
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 ln -s $SCRIPTPATH/$1 $2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 echo "Unable to link $1 config - $2 already existed" >&2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 fi
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 #Else it already existed but was correct
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 }
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 create_symlink tmux.conf ~/.tmux.conf
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 create_symlink hgrc ~/.hgrc
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 create_symlink bashrc ~/.bashrc