-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·81 lines (68 loc) · 2.09 KB
/
setup
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
#!/bin/sh
FILEPATH=$(greadlink -f "$0")
DIR=$(dirname "$FILEPATH")
FILES=".bash .bashrc .gemrc .gitignore_global .gvimrc .tmux.conf .vimrc .vim .zshrc"
for FILE in $FILES; do
SOURCE="$DIR/$FILE"
TARGET="$HOME/$FILE"
move_and_symlink_file () {
if [ ! -h "${TARGET}" ]; then # if target not a symlink
if [ -e "${TARGET}" ] ; then # if target exists
echo "${FILE} exists, moving to ${FILE}.old";
mv -f $TARGET $TARGET.old # move target;
fi
fi
echo
echo "Symlinking $SOURCE to $TARGET"
if [ -h "${TARGET}" ]; then
ln -fs $SOURCE $TARGET
else
ln -s $SOURCE $TARGET
fi
echo
}
while true; do
read -p "Do you wish to symlink ${FILE}? " yn
case $yn in
[Yy]* ) move_and_symlink_file;
break;;
[Nn]* ) break;;
*) echo "Please answer (y)es or (n)o.";;
esac
done
done
if [ ! -d "$HOME/.vim/bundle/vundle" ] ; then
while true; do
read -p "do you wish to install Vundle for Vim? " yn
case $yn in
[Yy]* ) git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle;
vim +BundleInstall +qall;
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
if ! command -v zsh > /dev/null; then
while true; do
read -p "zsh not installed. Do you want to install zsh? " yn
case $yn in
[Yy]* ) sudo apt-get install zsh;
chsh -s /bin/zsh;
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
if [ ! -d "$HOME/.oh-my-zsh" ] ; then
while true; do
read -p "Do you wish to install Oh-My-Zsh? " yn
case $yn in
[Yy]* ) git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh;
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi