-
Notifications
You must be signed in to change notification settings - Fork 3
/
install
executable file
·59 lines (42 loc) · 1.69 KB
/
install
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# This script assumes it is positioned in dotfiles directory
DOT_DIR=$( cd $(dirname $0) ; pwd -P ) # absolute path to dotfiles directory
COLOR_NONE='\e[0m'
COLOR_BROWN='\e[0;33m'
COLOR_WHITE='\e[1;37m'
# Takes source and target and creates link if it does not exist
install_link() {
local s=$1
local t=$2
# if correct link exists
if [[ -L $t && $(readlink -f $t) == $(readlink -f $s) ]]; then
echo -e "${COLOR_BROWN}Link already installed${COLOR_NONE}"
return 0
fi
ln --symbolic --no-target-directory --interactive --verbose $s $t
}
echo "Installing dotfiles..."
echo "Installing emacs.d:"
install_link $DOT_DIR/emacs.d $HOME/.emacs.d
echo "Installing .spacemacs.d:"
install_link $DOT_DIR/spacemacs.d $HOME/.spacemacs.d
echo "Installing .vimrc:"
install_link $DOT_DIR/vimrc $HOME/.vimrc
echo "Installing login session configuration files:"
install_link $DOT_DIR/profile $HOME/.profile
install_link $DOT_DIR/bash/bash_profile $HOME/.bash_profile
install_link $DOT_DIR/bash/bashrc $HOME/.bashrc
install_link $DOT_DIR/bash/bash_aliases $HOME/.bash_aliases
if [ ! -e $HOME/.bashrc_local ]; then
echo "# Put bash settings specific for this machine here. Loaded by .bashrc" \
> $HOME/.bashrc_local
echo "$HOME/.bashrc_local created. Put machine specific bash settings here!"
fi
echo "Installing git completion:"
install_link $DOT_DIR/git/git-completion.bash $HOME/.git-completion.bash
install_link $DOT_DIR/git/git-prompt.sh $HOME/.git-prompt.sh
echo "Installing global gitconfig:"
install_link $DOT_DIR/git/gitconfig $HOME/.gitconfig
echo "Installing global gitignore:"
install_link $DOT_DIR/git/gitignore $HOME/.gitignore
echo "Installation finished!"