-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostinstall.sh
executable file
·249 lines (192 loc) · 7.03 KB
/
postinstall.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
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
#!/bin/bash
DOTFILES_DIR="$HOME/dev/dotfiles"
source "$DOTFILES_DIR/helpers.sh"
function install_NODE_ENV {
echo "Installing node, fnm & yarn"
curl https://raw.githubusercontent.com/Schniz/fnm/master/.ci/install.sh | bash
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH=$HOME/.fnm:$PATH
eval `fnm env`
fnm install 18.12.1
fnm use 18.12.1
# yarn adds itself to the $PATH when being installed
# but yarn path is already exported in ~/.zsh/exports.zsh
# the following line removes that from ~/.zshrc
sed -i -e "/export\sPATH=\"\$HOME\/\.yarn\/bin:\$PATH/d" "$DOTFILES_DIR/zsh/zshrc"
echo ""
}
function install_VIM_PLUGINS {
# only run if yarn & npm are installed
if hash npm 2>/dev/null && hash yarn 2>/dev/null; then
echo "Installing vim plugins"
vim +PlugInstall +qall
# fzf adds a a call to source fzf to the ~/.zshrc, since it's already in
# ~/.zsh/sources.zsh the following lines removes that from ~/.zshrc
sed -i -e "/\n\[\s-f\s~\/\.fzf\.zsh\s\]\s&&\ssource\s~\/\.fzf\.zsh/d" "$DOTFILES_DIR/zsh/zshrc"
echo ""
echo "Installing YouCompleteMe (for Go, JS, TS), tern_for_vim and typescript"
cd ~/.vim/bundle/YouCompleteMe
./install.py --gocode-completer --tern-completer --clang-completer --rust-completer
cd ~/.vim/bundle/tern_for_vim
yarn
yarn global add typescript livedown
echo ""
echo "Installing vim-elm dependencies"
yarn global add elm elm-test elm-oracle elm-format create-elm-app
echo ""
echo "Installing nerd-fonts"
git clone --depth 1 [email protected]:ryanoasis/nerd-fonts.git ~/dev/nerd-fonts
cd ~/dev/nerd-fonts
./install.sh 'FiraCode'
cd ~
echo ""
# TODO: move this from here, it's not vim related
echo "Installing other programs from npm"
yarn global add npm-ls-scripts bs-platform serve diff-so-fancy
echo ""
echo "Installing vim-go dependencies"
vim +GoInstallBinaries +qall
echo ""
else
echo "In order to install vim packages you first need node & npm installed"
fi
}
function install_HASKELL {
# Install Haskell's Stack
echo "Installing Haskell's Stack"
curl -sSL https://get.haskellstack.org/ | sh
link "$DOTFILES_DIR/haskell/ghci" ~/.ghci
mkdir -p ~/.stack/global-project
link "$DOTFILES_DIR/haskell/global-stack.yml" ~/.stack/global-project/stack.yaml
chmod go-w ~/.ghci
stack install hlint hfmt
echo ""
}
function install_RUST {
# Install Rust
echo "Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo ""
# https://github.com/BurntSushi/ripgrep
# https://github.com/sharkdp/fd
# https://github.com/sharkdp/bat
# https://github.com/dalance/amber
# https://github.com/brigand/glint
# https://the.exa.website/
# https://github.com/lsd-rs/lsd
cargo install ripgrep fd-find bat amber glint exa lsd
cargo install alacritty
link "$DOTFILES_DIR/alacritty/alacritty.yml" "$XDG_CONFIG_HOME/alacritty.yml"
sudo update-alternatives --install $(which x-terminal-emulator) x-terminal-emulator $(which alacritty) 60
echo ""
}
function install_GOLANG {
# Install Golang
echo "Installing Go"
git clone https://github.com/udhos/update-golang ~/dev/update-golang
cd ~/dev/update-golang
sudo ./update-golang.sh
gitUsername=$(git config --global user.name)
if [ ! -z "$gitUsername" ] ;then
echo "Creating your Github's go directory"
mkdir -p $GOPATH/src/github.com/$gitUsername
fi
mkdir -p ~/dev/go
GOPATH="$HOME/dev/go"
export GO_BIN="$GOPATH/bin:/usr/local/go/bin"
# goinstall "Find Unleashed" github.com/kbrgl/fu
goinstall gocode github.com/mdempsky/gocode
# only install td if fetching todos-data is succesful
# since it's a private repo, so only would work for me
git clone [email protected]:gillchristian/todos-data.git ~/.todos
# if [ $? -eq 0 ]; then
# goinstall Todos github.com/gillchristian/todos/cmd/td
# fi
}
function install_DOCKER_COMPOSE {
# TODO: prompt version
echo "Installing docker-compose"
sudo touch /usr/local/bin/docker-compose
touch /tmp/docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64 -o /tmp/docker-compose
sudo mv /tmp/docker-compose /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo ""
}
function install_DOCKER {
echo "Installing Docker"
sudo apt remove docker docker-engine docker.io
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
echo "Verifying fingerprint"
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt install docker-ce
echo "Verifying Docker installation"
sudo docker run hello-world
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker
install_DOCKER_COMPOSE
echo "After the installation restart the computer and run \`\$ docker run hello-world\`"
echo ""
}
function install_ANTIBODY {
echo "Installing Antibody and adding config"
curl -sfL git.io/antibody | sh -s - -b "$HOME/bin"
echo ""
echo "Installing plugins with antibody"
antibody bundle < "$DOTFILES_DIR/zsh/antibodyrc" > ~/.antibody_plugins.sh
antibody update
echo ""
}
function install_K8S {
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
}
function install_GCLOUD {
# @link https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
}
function install_MINIKUBE {
# https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service
sudo systemctl status libvirtd.service
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
sudo install docker-machine-driver-kvm2 /usr/local/bin/
# https://github.com/kubernetes/minikube#installation
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube config set vm-driver kvm2
}
function main {
install_NODE_ENV
install_DOCKER
install_RUST
install_ANTIBODY
# install_VIM_PLUGINS
# install_HASKELL
# install_GOLANG
# install_K8S
# install_MINIKUBE
# install_GCLOUD
# after calling sed to remove something from the
# file that is symlinked the symlink gets broken
echo "Relinking ~/.zsrc"
link "$DOTFILES_DIR/zsh" ~/.zsh
echo "All done!"
echo ""
}
# main
install_ANTIBODY