annotate setup.sh @ 9:3728d07afc2c

Trust system's CA bundle (otherwise StartSSL certs weren't accepted)
author IBBoard <dev@ibboard.co.uk>
date Fri, 20 Sep 2013 19:52:41 +0000
parents 17c094cc54e3
children 281a9cb03796
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() {
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
5 SOURCEFILE=$1
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
6 if [ "${SOURCEFILE:0:1}" != "/" ]; then
5
17c094cc54e3 Fix variable naming typo
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
7 SOURCEFILE=$SCRIPTPATH/$1
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
8 fi
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 if [ ! -e $2 ]; then
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
10 ln -s $SOURCEFILE $2
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 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
13 fi
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 #Else it already existed but was correct
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 }
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16
4
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
17 add_content() {
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
18 if [ -e $2 ]; then
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
19 grep -F -q "$1" $2 2>&1
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
20 else
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
21 false
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
22 fi
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
23 if [ $? -ne 0 ]; then
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
24 echo "$1" >> $2
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
25 fi
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
26 }
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
27
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 create_symlink tmux.conf ~/.tmux.conf
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 create_symlink hgrc ~/.hgrc
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
30 create_symlink bashrc ~/.bashrc
4
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
31 create_symlink /usr/lib/python*/site-packages/hgext/hgview.py ~/.hgview.py
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
32 create_symlink gitconfig ~/.gitconfig
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
33 add_content "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2c3IUHY02FAJotQKs3x+uGZ+5XpuKbWUENevjTOF1bAGwGqKNSSg5SlsL5C9aHcu6O/eBKWJNpvUa0vcXXP18ddoILq1DvZfQHDylrweGbaRviSCpRZvSKiNREQd+yAQPwGnsfkpQe5RxXjRTsk7B0VKP2LFL5seDuQfQxtGc6AgjF0TMpBoKD3UkUlfqRX7Q0tQwfTgXTNxYyQOgG61bWeUsz0XSZelF1MHsXxLwUUFuZAigwiv9YUlBSAAEwWySyN8RdsJadunKYHbxr9cJfj4T5soKVeDi2n94AScFuokAyDf3MFvJ1PYZ0p4rFzNF2zrOK3rqvA3aGg4Bi+wx ssh@ibboard.co.uk" ~/.ssh/authorized_keys