forked from fatih/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·258 lines (229 loc) · 7.44 KB
/
bootstrap.sh
File metadata and controls
executable file
·258 lines (229 loc) · 7.44 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/bin/bash
set -eu
export DEBIAN_FRONTEND=noninteractive
UPGRADE_PACKAGES=${1:-none}
if [ "${UPGRADE_PACKAGES}" != "none" ]; then
echo "==> Updating and upgrading packages ..."
# Add third party repositories
sudo add-apt-repository ppa:keithw/mosh-dev -y
sudo add-apt-repository ppa:jonathonf/vim -y
CLOUD_SDK_SOURCE="/etc/apt/sources.list.d/google-cloud-sdk.list"
CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
if [ ! -f "${CLOUD_SDK_SOURCE}" ]; then
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a ${CLOUD_SDK_SOURCE}
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
fi
sudo apt-get update
sudo apt-get upgrade -y
fi
sudo apt-get install -qq \
apache2-utils \
apt-transport-https \
build-essential \
bzr \
ca-certificates \
clang \
cmake \
curl \
direnv \
dnsutils \
docker.io \
fakeroot-ng \
gdb \
git \
git-crypt \
gnupg \
gnupg2 \
google-cloud-sdk \
google-cloud-sdk-app-engine-go \
htop \
hugo \
ipcalc \
jq \
less \
libclang-dev \
liblzma-dev \
libpq-dev \
libprotoc-dev \
libsqlite3-dev \
libssl-dev \
libvirt-clients \
libvirt-daemon-system \
lldb \
locales \
man \
mosh \
mtr-tiny \
musl-tools \
ncdu \
netcat-openbsd \
openssh-server \
pkg-config \
protobuf-compiler \
pwgen \
python \
python3 \
python3-flake8 \
python3-pip \
python3-setuptools \
python3-venv \
python3-wheel \
qemu-kvm \
qrencode \
quilt \
ripgrep \
shellcheck \
silversearcher-ag \
socat \
software-properties-common \
sqlite3 \
stow \
sudo \
tig \
tmate \
tmux \
tree \
unzip \
wget \
zgen \
zip \
zlib1g-dev \
vim-gtk3 \
zsh \
--no-install-recommends \
rm -rf /var/lib/apt/lists/*
# install Go
if ! [ -x "$(command -v go)" ]; then
export GO_VERSION="1.14.2"
wget "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
rm -f "go${GO_VERSION}.linux-amd64.tar.gz"
export PATH="/usr/local/go/bin:$PATH"
fi
# install 1password
if ! [ -x "$(command -v op)" ]; then
export OP_VERSION="v0.5.6-003"
curl -sS -o 1password.zip https://cache.agilebits.com/dist/1P/op/pkg/${OP_VERSION}/op_linux_amd64_${OP_VERSION}.zip
unzip 1password.zip op -d /usr/local/bin
rm -f 1password.zip
fi
# install protobuf
if ! [ -x "$(command -v protoc)" ]; then
export PROTOBUF_VERSION="3.8.0"
mkdir -p protobuf_install
pushd protobuf_install
wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
mv bin/protoc /usr/local/bin
mv include/* /usr/local/include/
popd
rm -rf protobuf_install
fi
# install tools
if ! [ -x "$(command -v jump)" ]; then
echo " ==> Installing jump .."
export JUMP_VERSION="0.23.0"
wget https://github.com/gsamokovarov/jump/releases/download/v${JUMP_VERSION}/jump_${JUMP_VERSION}_amd64.deb
sudo dpkg -i jump_${JUMP_VERSION}_amd64.deb
rm -f jump_${JUMP_VERSION}_amd64.deb
fi
VIM_PLUG_FILE="${HOME}/.vim/autoload/plug.vim"
if [ ! -f "${VIM_PLUG_FILE}" ]; then
echo " ==> Installing vim plugins"
curl -fLo ${VIM_PLUG_FILE} --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
mkdir -p "${HOME}/.vim/plugged"
pushd "${HOME}/.vim/plugged"
git clone "https://github.com/AndrewRadev/splitjoin.vim"
git clone "https://github.com/ConradIrwin/vim-bracketed-paste"
git clone "https://github.com/Raimondi/delimitMate"
git clone "https://github.com/SirVer/ultisnips"
git clone "https://github.com/cespare/vim-toml"
git clone "https://github.com/corylanou/vim-present"
git clone "https://github.com/ekalinin/Dockerfile.vim"
git clone "https://github.com/elzr/vim-json"
git clone "https://github.com/fatih/vim-hclfmt"
git clone "https://github.com/fatih/vim-nginx"
git clone "https://github.com/fatih/vim-go"
git clone "https://github.com/hashivim/vim-hashicorp-tools"
git clone "https://github.com/junegunn/fzf.vim"
git clone "https://github.com/mileszs/ack.vim"
git clone "https://github.com/roxma/vim-tmux-clipboard"
git clone "https://github.com/plasticboy/vim-markdown"
git clone "https://github.com/scrooloose/nerdtree"
git clone "https://github.com/t9md/vim-choosewin"
git clone "https://github.com/tmux-plugins/vim-tmux"
git clone "https://github.com/tmux-plugins/vim-tmux-focus-events"
git clone "https://github.com/fatih/molokai"
git clone "https://github.com/tpope/vim-commentary"
git clone "https://github.com/tpope/vim-eunuch"
git clone "https://github.com/tpope/vim-fugitive"
git clone "https://github.com/tpope/vim-repeat"
git clone "https://github.com/tpope/vim-scriptease"
git clone "https://github.com/ervandew/supertab"
popd
fi
if [ ! -d "$(go env GOPATH)" ]; then
echo " ==> Installing Go tools"
# vim-go tooling
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/gopls
go get -u -v golang.org/x/lint/golint
go get -u -v github.com/josharian/impl
go get -u -v honnef.co/go/tools/cmd/keyify
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/fatih/motion
go get -u -v github.com/koron/iferr
# generic
go get -u -v github.com/aybabtme/humanlog/cmd/...
go get -u -v github.com/fatih/hclfmt
cp -r $(go env GOPATH)/bin/* /usr/local/bin/
fi
if [ ! -d "${HOME}/.fzf" ]; then
echo " ==> Installing fzf"
git clone https://github.com/junegunn/fzf "${HOME}/.fzf"
pushd "${HOME}/.fzf"
git remote set-url origin git@github.com:junegunn/fzf.git
${HOME}/.fzf/install --bin --64 --no-bash --no-zsh --no-fish
popd
fi
if [ ! -d "${HOME}/.zsh" ]; then
echo " ==> Installing zsh plugins"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${HOME}/.zsh/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "${HOME}/.zsh/zsh-autosuggestions"
fi
if [ ! -d "${HOME}/.tmux/plugins" ]; then
echo " ==> Installing tmux plugins"
git clone https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
git clone https://github.com/tmux-plugins/tmux-open.git "${HOME}/.tmux/plugins/tmux-open"
git clone https://github.com/tmux-plugins/tmux-yank.git "${HOME}/.tmux/plugins/tmux-yank"
git clone https://github.com/tmux-plugins/tmux-prefix-highlight.git "${HOME}/.tmux/plugins/tmux-prefix-highlight"
fi
echo "==> Setting shell to zsh..."
chsh -s /usr/bin/zsh
echo "==> Creating dev directories"
mkdir -p /root/code
if [ ! -d /root/code/dotfiles ]; then
echo "==> Setting up dotfiles"
# the reason we dont't copy the files individually is, to easily push changes
# if needed
cd "/root/code"
git clone --recursive https://github.com/fatih/dotfiles.git
cd "/root/code/dotfiles"
git remote set-url origin git@github.com:fatih/dotfiles.git
ln -sfn $(pwd)/vimrc "${HOME}/.vimrc"
ln -sfn $(pwd)/zshrc "${HOME}/.zshrc"
ln -sfn $(pwd)/tmuxconf "${HOME}/.tmux.conf"
ln -sfn $(pwd)/tigrc "${HOME}/.tigrc"
ln -sfn $(pwd)/git-prompt.sh "${HOME}/.git-prompt.sh"
ln -sfn $(pwd)/gitconfig "${HOME}/.gitconfig"
ln -sfn $(pwd)/agignore "${HOME}/.agignore"
ln -sfn $(pwd)/sshconfig "${HOME}/.ssh/config"
fi
echo ""
echo "==> Done!"