-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·90 lines (83 loc) · 2.28 KB
/
setup.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
#!/bin/bash
TARGET='__all__'
DOTFILES_PATH=$(pwd)
BIN_FOLDER="bin"
if [ "$1" == '' ]; then
TARGET='__all__'
elif [ "$1" == 'vim' ]; then
TARGET='vim'
elif [ "$1" == 'bash' ]; then
TARGET='bash'
elif [ "$1" == 'bin' ]; then
TARGET='bin'
elif [ "$1" == 'go' ]; then
TARGET='go'
else
echo "Invalid target"
exit 1
fi
if [ $TARGET == '__all__' -o $TARGET == 'bash' ]; then
echo -n "Enter hostname name:"
read HOSTNAME
echo $HOSTNAME > ${DOTFILES_PATH}/hostname
cd ~
FILES=(".tmux.conf" ".gitconfig" ".bash_profile" ".gitignore" ".ackrc" ".inputrc" ".agignore" ".pythonrc" ".kube_alias")
for F in ${FILES[@]}; do
if [ -e "$F" ]; then
rm -rf $F;
fi
done
ln -s ${DOTFILES_PATH}/bash_profile .bash_profile
ln -s ${DOTFILES_PATH}/tmuxconf .tmux.conf
ln -s ${DOTFILES_PATH}/gitconfig .gitconfig
ln -s ${DOTFILES_PATH}/gitignore .gitignore
ln -s ${DOTFILES_PATH}/ackrc .ackrc
ln -s ${DOTFILES_PATH}/inputrc .inputrc
ln -s ${DOTFILES_PATH}/agignore .agignore
ln -s ${DOTFILES_PATH}/pythonrc.py .pythonrc
ln -s ${DOTFILES_PATH}/kube_alias .kube_alias
if [ -e ".bashrc" ]; then
mv .bashrc .bashrc.old
fi
fi
cd ${DOTFILES_PATH}
if [ $TARGET == '__all__' -o $TARGET == 'vim' ]; then
if [ ! -e vimfiles ]; then
git clone [email protected]:zwodahs/vimfiles ${DOTFILES_PATH}/vimfiles
if [ -e .vim ]; then
echo ".vim exist, backup to .vim.old"
if [ ! -e .vim.old ]; then
mv .vim .vim.old
else
echo ".vim.old exist"
exit 1
fi
fi
cd ~
ln -s ${DOTFILES_PATH}/vimfiles .vim
cd ${DOTFILES_PATH}/vimfiles
./setup.sh
cd ~
if [ -e .vimrc ]; then
rm -rf .vimrc
fi
ln -s .vim/vimrc .vimrc
fi
fi
if [ ${TARGET} == '__all__' -o ${TARGET} == 'go' ]; then
if [ ! -e "~/.go" ]; then
mkdir ${HOME}/.go
pushd ${HOME}/.go
for FDR in bin pkg src; do
mkdir $FDR
done
popd
fi
if [ -e "~/.gopath" ]; then
if [ -z "$(cat ~/.gopath | grep ${HOME}/.go)" ]; then
echo "${HOME}/.go" >> ~/.gopath
fi
else
echo "${HOME}/.go" >> ~/.gopath
fi
fi