annotate setup.sh @ 90:4342e7b19fa8

Standardise nanorc colouring with other file types
author IBBoard <dev@ibboard.co.uk>
date Mon, 02 Apr 2018 17:20:47 +0100
parents b989099cde9f
children 9f3d2d765a0f
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
83
966d8f8f89d0 Make sure that directories exist, since not all files are in ~/
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
9 parent_dir=$(dirname "$2")
966d8f8f89d0 Make sure that directories exist, since not all files are in ~/
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
10 if [ ! -d "$parent_dir" ]; then
966d8f8f89d0 Make sure that directories exist, since not all files are in ~/
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
11 mkdir "$parent_dir"
966d8f8f89d0 Make sure that directories exist, since not all files are in ~/
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
12 fi
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 if [ ! -e $2 ]; then
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
14 ln -s $SOURCEFILE $2
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 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
17 fi
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 #Else it already existed but was correct
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 }
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20
4
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
21 add_content() {
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
22 if [ -e $2 ]; then
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
23 grep -F -q "$1" $2 2>&1
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
24 else
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
25 false
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
26 fi
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
27 if [ $? -ne 0 ]; then
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
28 echo "$1" >> $2
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
29 fi
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
30 }
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
31
2
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 create_symlink tmux.conf ~/.tmux.conf
a5fc9c16087c Add setup script to symlink files
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 create_symlink hgrc ~/.hgrc
64
39b07c5f8785 Add Git and Mercurial support to command prompt
IBBoard <dev@ibboard.co.uk>
parents: 48
diff changeset
34 create_symlink prompt.py ~/.hg-prompt.py
3
2a6d32a03c0e Work around differing paths for hgview
IBBoard <dev@ibboard.co.uk>
parents: 2
diff changeset
35 create_symlink bashrc ~/.bashrc
24
acbc487533ab Consistently fix Thunderbird time settings by moving some bits to profile, not bashrc
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
36 create_symlink profile ~/.profile
48
39bdd245431b Add inputrc to make tab-complete do colour highlighting
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
37 create_symlink inputrc ~/.inputrc
4
2c7cac745457 * Add git config
IBBoard <dev@ibboard.co.uk>
parents: 3
diff changeset
38 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
39 create_symlink gitconfig ~/.gitconfig
11
281a9cb03796 Add custom colouring for "ls" output
IBBoard <dev@ibboard.co.uk>
parents: 5
diff changeset
40 create_symlink dircolors ~/.dir_colors
18
1ec9a1720c5c Add XCompose (custom compose key combinations for odd characters) and Nano config
IBBoard <dev@ibboard.co.uk>
parents: 11
diff changeset
41 create_symlink nanorc ~/.nanorc
84
b989099cde9f Start to update Nano colourisation
IBBoard <dev@ibboard.co.uk>
parents: 83
diff changeset
42 create_symlink nanorc.d ~/.nanorc.d
18
1ec9a1720c5c Add XCompose (custom compose key combinations for odd characters) and Nano config
IBBoard <dev@ibboard.co.uk>
parents: 11
diff changeset
43 create_symlink XCompose ~/.XCompose
82
220ca3e2e115 Add emoji config to standard build (requires Noto Color Emoji font)
IBBoard <dev@ibboard.co.uk>
parents: 76
diff changeset
44 create_symlink 10-noto-emoji.conf ~/.config/fontconfig/conf.d/10-noto-emoji.conf
76
fb379103c457 Add custom mime config to make Nautilus show more icons
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
45 create_symlink mime-extra.xml ~/.local/share/mime/packages/IBBoard-extra.xml
fb379103c457 Add custom mime config to make Nautilus show more icons
IBBoard <dev@ibboard.co.uk>
parents: 64
diff changeset
46 update-mime-database ~/.local/share/mime/
25
59f5444ef031 Don't assume that ~/.ssh already exists
IBBoard <dev@ibboard.co.uk>
parents: 18
diff changeset
47 mkdir -p ~/.ssh
18
1ec9a1720c5c Add XCompose (custom compose key combinations for odd characters) and Nano config
IBBoard <dev@ibboard.co.uk>
parents: 11
diff changeset
48 add_content "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2c3IUHY02FAJotQKs3x+uGZ+5XpuKbWUENevjTOF1bAGwGqKNSSg5SlsL5C9aHcu6O/eBKWJNpvUa0vcXXP18ddoILq1DvZfQHDylrweGbaRviSCpRZvSKiNREQd+yAQPwGnsfkpQe5RxXjRTsk7B0VKP2LFL5seDuQfQxtGc6AgjF0TMpBoKD3UkUlfqRX7Q0tQwfTgXTNxYyQOgG61bWeUsz0XSZelF1MHsXxLwUUFuZAigwiv9YUlBSAAEwWySyN8RdsJadunKYHbxr9cJfj4T5soKVeDi2n94AScFuokAyDf3MFvJ1PYZ0p4rFzNF2zrOK3rqvA3aGg4Bi+wx ssh@ibboard.co.uk" ~/.ssh/authorized_keys