-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·42 lines (34 loc) · 889 Bytes
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
#TODO: Make this script idempotent
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
_linkfiles () {
# Get filenames
local_path="$DIR/$1"
home_path="$HOME/${2:-$1}"
# Backup existing file
if [ -e $home_path ]; then
bak_path=$home_path.bak
i=2
while [ -e $bak_path ]; do
bak_path=$home_path.bak$i
let i+=1
done
mv $home_path $bak_path
fi
# Create link
ln -s $local_path $home_path
}
## Commence installation of config files
_linkfiles .bash_aliases
_linkfiles .git_aliases
_linkfiles .git_bash_prompt
_linkfiles .gitconfig
_linkfiles solarized_dircolors.ansi-dark .dircolors
_linkfiles .tmux.conf
# TODO: Make these idempotent
cat $DIR/.bash_profile_additions >> $HOME/.bash_profile
cat $DIR/.bashrc_additions >> $HOME/.bashrc
# Set solarized colors for gnome-terminal
# source $DIR/solarize_gnome_terminal.sh
unset DIR
unset -f _linkfiles