-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·61 lines (52 loc) · 1.11 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
#!/bin/bash -e
mydir=$(readlink -f "$(dirname "$0")")
libexec="$mydir/libexec"
# base files
for f in $(ls -a "$mydir"); do
case "$f" in
.|..|.git|README*|*.sh|libexec|*.swp|*~)
continue
esac
symlink="$HOME/$f"
if test -e "$symlink" -a ! -L "$symlink"; then
echo "INFO: skip $f"
continue
else
ln -sfn "$mydir/$f" "$symlink"
fi
done
# optional modules
for name in "$@"; do
script="$libexec/install-${name}.sh"
if ! test -x "$script"; then
echo "ERROR: unknown module: $name"
exit 1
else
echo "INFO: install $name"
"$script"
fi
done
# .ssh directory
if ! test -e "$HOME/.ssh"; then
mkdir "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
mkdir "$HOME/.ssh/sockets"
cat > "$HOME/.ssh/config" <<EOS
ForwardAgent yes
ServerAliveInterval 120
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h:%p
EOS
fi
# .vimrc
if ! test -e "$HOME/.vimrc.local.plugins"; then
cat > "$HOME/.vimrc.local.plugins" <<EOS
" Plug 'pangloss/vim-javascript'
" Plug 'posva/vim-vue'
" Plug 'mxw/vim-jsx'
" Plug 'uarun/vim-protobuf'
" Plug 'tpope/vim-haml'
" Plug 'pearofducks/ansible-vim'
EOS
fi