-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·106 lines (85 loc) · 2.44 KB
/
install.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
ROOTDIR=$(dirname $0)
# Functions
function _create_dir()
{
[ -d $1 ] || mkdir -p $1 || echo Failed to create $1
}
function _create_symlink()
{
[ -f $2 ] || ln -s $(realpath $1) $2 || echo Failed to create symlink $1
}
function _dnload()
{
if [ "$(uname)" == "Darwin" ]; then
[ -f $2 ] || curl -SLso $2 $1 || echo Failed to create $1
else
[ -f $2 ] || wget -O $2 $1 || echo Failed to create $1
fi
}
function _git_get_repo()
{
if [ -d $2 ]; then
pushd $2 && git pull && popd
else
git clone $1 $2 || echo Failed to clone $1 to $2
fi
}
# Start of install script
echo "Installing dotfiles"
echo "Creating symlinks ($ROOTDIR)"
linkables=$( ls -1 -d $ROOTDIR/**/*.symlink )
for file in $linkables ; do
target="$HOME/.$( basename $file ".symlink" )"
echo " creating symlink for $file"
_create_symlink $file $target
done
# OS X
if [ "$(uname)" == "Darwin" ]; then
echo "Running on OS X"
echo "Installing homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "brew install"
source $ROOTDIR/osx/brew.sh
echo "Environment"
source $ROOTDIR/osx/env.sh
elif [ "$(uname)" == "Linux" ]; then
echo "Running on Linux"
_create_dir $HOME/.config/terminator
_create_symlink $ROOTDIR/terminator.config $HOME/.config/terminator/config
echo "Environment"
source $ROOTDIR/linux/env.sh
fi
# tmux
if [[ ! -d "$HOME/.tmux/plugins/tpm" ]]; then
_git_get_repo https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm
$HOME/.tmux/plugins/tpm/bin/install_plugins
fi
# zsh
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
_git_get_repo git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
fi
# Install powerline fonts
pushd /tmp
git clone https://github.com/powerline/fonts powerfonts
powerfonts/install.sh
rm -rf powerfonts
popd
# Vim
echo "Setting up Vim"
_create_dir $HOME/.vim/bundle
_create_dir $HOME/.vim/plugin
_create_dir $HOME/.vim/syntax
_create_dir $HOME/.vim/tmp/swap
_create_dir $HOME/.vim/tmp/backup
_create_dir $HOME/.vim/tmp/undo
_create_symlink $ROOTDIR/vim/plugins.vim $HOME/.vim/plugins.vim
_create_symlink $ROOTDIR/vim/coc.vim $HOME/.vim/coc.vim
_create_symlink $ROOTDIR/vim/nerdtree_plugin $HOME/.vim/nerdtree_plugin
_git_get_repo https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# Emacs
_create_symlink $ROOTDIR/emacs.d $HOME/.emacs.d
echo "Configuring zsh as default shell"
chsh -s $(which zsh)
echo "Done."