forked from demonlife/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·99 lines (78 loc) · 1.72 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
#!/usr/bin/env bash
# wget https://raw.github.com/luin/dotfiles/master/Makefile -O - | make -- install
master="git://github.com/foobarren/dotfiles.git"
vundle="git://github.com/gmarik/vundle.git"
destpath=`echo ~`
dest=${destpath}/.foobarren_dotfiles
function download {
rm -rf ${dest}
git clone ${master} ${dest}
}
function install_yum {
sudo yum install -y ctags ack grep git tig
}
function install_pip {
pip
if [ $? -eq 0 ]; then
echo "pip had installed!"
else
curl -O "https://raw.github.com/pypa/pip/master/contrib/get-pip.py"
sudo python get-pip.py
fi
sudo pip install pylint
sudo pip install virtualenvwrapper
sudo pip install coverage
sudo pip install isort
sudo pip install jedi
}
function install_zsh {
ln -fs ${dest}/zshrc ~/.zshrc
}
function install_vim {
ln -fs ${dest}/vimrc ~/.vimrc
rm -rf ~/.vim/bundle/vundle
git clone -q ${vundle} ~/.vim/bundle/vundle
vim +NeoBundleInstall +qall
mkdir -p ~/.vim/undo
}
function install_all {
install_yum
install_vim
install_pip
install_zsh
}
function link_file {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
if [ -L "${target}" ]; then
unlink $target
fi
if [ -e "${target}" ] && [ ! -L "${target}" ]; then
mv $target $target.df.bak
fi
ln -sf ${source} ${target}
}
function unlink_file {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
if [ -e "${target}.df.bak" ] && [ -L "${target}" ]; then
unlink ${target}
mv $target.df.bak $target
fi
}
function link {
if [ "$1" = "restore" ]; then
for i in _*
do
unlink_file $i
done
exit
else
for i in _*
do
link_file $i
done
fi
}
download
install_$1