-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·115 lines (101 loc) · 2.42 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
#!/bin/bash
STOW=/usr/bin/stow
if [ ! -x ${STOW} ]; then
echo "Need to apt-get install stow"
exit 1
fi
STOWARGS="-v -t ${HOME}"
VIM=/usr/bin/vim
VIMDIR=${HOME}/.vim
VUNDLEDIR=${VIMDIR}/bundle/Vundle.vim
easy_packages="bash gdb git readline tmux executables pylint terminfo"
install_easy() {
${STOW} ${STOWARGS} "${1}"
}
install_vim() {
install_easy vim_full
if [ -d "${VUNDLEDIR}" ]; then
pushd "${VUNDLEDIR}"
git pull
popd
${VIM} +PluginInstall! +qall
else
git clone https://github.com/VundleVim/Vundle.vim.git "${VUNDLEDIR}"
${VIM} +PluginInstall +qall
fi
pushd "${VIMDIR}/bundle/YouCompleteMe"
python3 install.py --clang-completer
popd
}
install_julia() {
mkdir -p "${HOME}/.julia/config"
stow -t "${HOME}/.julia/config" julia
pushd "${VIMDIR}/bundle/lsp-examples"
python3 install.py --enable-julia
popd
}
remove_existing() {
rm ~/.bash_logout ~/.bashrc ~/.profile
}
install_minimal() {
for pkg in ${easy_packages}; do
install_easy "$pkg"
done
pushd git && cp .gitconfig.template .gitconfig ; popd
install_easy vim
}
install_all() {
for pkg in ${easy_packages}; do
install_easy "$pkg"
done
pushd git && cp .gitconfig.template .gitconfig ; popd
if [ -x "$(which vim)" ] && [ -x "$(which git)" ] && vim --version | grep -q +python; then
echo "Installing complete vim config"
install_vim
else
echo "Installing simple vim config, need git and vim with python support for full config"
install_easy vim
fi
install_julia
}
usage() {
echo "Install dotfiles."
echo "Must specify one of -a, -m or -o <name>."
echo " -m Minimal install. Just the basics. Deletes existing config."
echo " -a Complete install. Deletes existing config."
echo " -o <name> Install just the one set of config files under <name>."
}
while getopts ":hamo:" opt; do
case ${opt} in
h ) # process option h
usage
exit 0
;;
a )
remove_existing
install_all
exit 0
;;
o )
install_easy ${OPTARG}
exit 0
;;
m )
remove_existing
install_minimal
exit 0
;;
\? )
echo Unknown option ${OPTARG}
usage
exit 1
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
usage
exit 1
;;
esac
done
usage
exit 1