-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·118 lines (105 loc) · 2.77 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
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
rbenv_install_or_update()
{
echo "[CHECK] rbenv"
if [ -d $HOME/.rbenv ]
then
echo "[UPDATE] git pull rbenv"
cd $HOME/.rbenv
git pull origin master
ruby_build_install_or_update 1
else
echo "[INSTALL] git clone rbenv"
git clone [email protected]:rbenv/rbenv.git $HOME/.rbenv
exec $SHELL
ruby_build_install_or_update 1
fi
rbenv rehash
}
ruby_build_install_or_update()
{
mkdir -p $HOME/.rbenv/plugins
cd $HOME/.rbenv/plugins
echo "[CHECK] ruby-build"
if [ -d $HOME/.rbenv/plugins/ruby-build ]
then
echo "[UPDATE] git pull ruby-build"
cd $HOME/.rbenv/plugins/ruby-build
git pull origin master
else
echo "[INSTALL] git clone ruby-build"
cd $HOME/.rbenv/plugins
git clone [email protected]:rbenv/ruby-build.git $HOME/.rbenv/plugins/ruby-build
fi
}
oh_my_zsh_install_or_update()
{
echo "[CHECK] Oh-My-Zsh"
if [ -d $HOME/.oh-my-zsh ]
then
echo "[UPDATE] git pull Oh-My-Zsh"
cd $HOME/.oh-my-zsh
git pull origin master
else
echo "[INSTALL] git clone Oh-My-Zsh"
git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
fi
}
zsh_completions_install_or_update()
{
echo "[CHECK] zsh-completions"
if [ -d $HOME/.zsh-completions ]
then
echo "[UPDATE] git pull zsh-completions"
cd $HOME/.zsh-completions
git pull origin master
else
echo "[INSTALL] git clone zsh-completions"
git clone git://github.com/zsh-users/zsh-completions.git $HOME/.zsh-completions
# You may have to force rebuild `zcompdump`:
rm -f $HOME/.zcompdump
compinit
fi
}
delete_old_files()
{
echo "[DELETE] Delete the old files"
rm -f $HOME/.bashrc
rm -f $HOME/.bundle/config
rm -f $HOME/.gemrc
rm -f $HOME/.gitignore
rm -f $HOME/.gvimrc
rm -f $HOME/.powconfig
rm -f $HOME/.railsrc
rm -f $HOME/.vimrc
rm -f $HOME/.zshenv
rm -f $HOME/.zshrc
#rm ~/.gitconfig
}
symlink_files()
{
echo "[Symlink] Symlinking files"
ln -s $HOME/dotfiles/bashrc $HOME/.bashrc
ln -s $HOME/dotfiles/bundle_config $HOME/.bundle/config
ln -s $HOME/dotfiles/gemrc $HOME/.gemrc
ln -s $HOME/dotfiles/gitignore $HOME/.gitignore
ln -s $HOME/dotfiles/gvimrc $HOME/.gvimrc
ln -s $HOME/dotfiles/powconfig $HOME/.powconfig
ln -s $HOME/dotfiles/railsrc $HOME/.railsrc
ln -s $HOME/dotfiles/vimrc $HOME/.vimrc
mkdir -p $HOME/.config/nvim
ln -s $HOME/dotfiles/nvim_init.vim $HOME/.config/nvim/init.vim
ln -s $HOME/dotfiles/zshenv $HOME/.zshenv
ln -s $HOME/dotfiles/zshrc $HOME/.zshrc
#ln -s $HOME/dotfiles/gitconfig ~/.gitconfig
}
#
# Main Start
#
rbenv_install_or_update 1
oh_my_zsh_install_or_update 1
zsh_completions_install_or_update 1
delete_old_files 1
symlink_files 1
echo "[DONE] All done."
cd $HOME