-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·111 lines (98 loc) · 3.21 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
#!/bin/bash
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdirp() {
if [ -e "$1" ]; then
if [ ! -d "$1" ]; then
echo "!! '$1' exists but is not a directory !!"
exit 1
fi
else
echo "** Creating directory '$1'"
fi
mkdir -p $1
}
install-raw() {
abs_source="$(readlink -f $1)"
if [ -e $2 ]; then
abs_target="$(readlink -f $2)"
if [ "$abs_source" == "$abs_target" ]; then
return # nothing to do
fi
fi
echo "** Linking '$2' to '$1'"
ln --backup=numbered --suffix="" -vrs "$1" "$2"
}
install-file() {
install-raw "$scriptdir/$1" "$2"
}
mkdirp "$HOME"
install-file "wallpaper.png" "$HOME/wallpaper.png"
install-file "tmux.conf" "$HOME/.tmux.conf"
install-file "zshrc" "$HOME/.zshrc"
install-file "xresources" "$HOME/.Xresources"
install-file "latexmkrc" "$HOME/.latexmkrc"
install-file "xmodmap" "$HOME/.xmodmap"
install-file "xinitrc" "$HOME/.xinitrc"
if [ -e "/usr/bin/nvim" ]; then
vimdir="$HOME/.config/nvim"
vimrc="$vimdir/init.vim"
else
vimdir="$HOME/.vim"
vimrc="$HOME/.vimrc"
fi
mkdirp "$vimdir/ftplugin"
install-file "vimrc" "$vimrc"
install-file "sh.vim" "$vimdir/ftplugin/sh.vim"
install-file "javascript.vim" "$vimdir/ftplugin/javascript.vim"
install-file "json.vim" "$vimdir/ftplugin/json.vim"
install-file "python.vim" "$vimdir/ftplugin/python.vim"
install-file "vimplugins" "$vimdir/plugins.vim"
mkdirp "$HOME/.config/i3/"
install-file "i3" "$HOME/.config/i3/config"
install-file "i3lock-multimonitor" "$HOME/.config/i3/i3lock-multimonitor"
mkdirp "$HOME/.config/i3status"
install-file "i3status" "$HOME/.config/i3status/config"
vimbundle="$vimdir/bundle"
mkdirp "$HOME/.backup"
mkdirp "$HOME/.undo"
if [ ! -e "$vimbundle" ]; then
mkdirp "$vimbundle"
if [ $vimbundle != "$HOME/.vim/bundle" ]; then
mkdirp "$HOME/.vim"
if [ -e "$HOME/.vim/bundle" ]; then
rm -rf "$HOME/.vim/bundle"
fi
install-raw "$vimbundle" "$HOME/.vim/bundle"
fi
git clone "https://github.com/VundleVim/Vundle.vim.git" "$vimbundle/Vundle.vim"
if [ -e "/usr/bin/nvim" ]; then
# shamelessly stolen from https://github.com/shoelick/dotfiles/blob/master/packages/neovim/neovim.sh#L78
nvim +colorscheme default +PluginInstall +qall
else
vim -s "$scriptdir/install.vim"
fi
if [ -d $vimbundle/youcompleteme ]; then
cur_dir=$(pwd)
cd "$vimbundle/youcompleteme"
# need to figure out what completers we have support for
ycm_args="--clang-completer"
if [ ! -z "$(command -v xbuild)" ]; then
ycm_args+=" --cs-completer"
fi
if [ ! -z "$(command -v npm)" ]; then
ycm_args+=" --js-completer"
fi
if [ ! -z "$(command -v rustc)" ]; then
ycm_args+=" --rust-completer"
fi
if [ ! -z "$(command -v javac)" ]; then
ycm_args+=" --java-completer"
fi
./install.py $ycm_args
cd $cur_dir
fi
fi
mkdirp "$HOME/.oh-my-zsh/custom/themes"
install-file "zsh-theme" "$HOME/.oh-my-zsh/custom/themes/custom.zsh-theme"
mkdirp "/etc/sudoers.d"
install-file "sudoers" "/etc/sudoers.d/99-keepenv"