-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·360 lines (278 loc) · 8.86 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
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#!/usr/bin/bash
set -euo pipefail
installUbuntuPackages() {
echo "==================================="
echo "Installing Ubuntu packages..."
echo "==================================="
# Temporary aliases
apti='sudo apt --assume-yes install'
# Updating the index
sudo apt-get update
cd ~/ || return
echo "Installing packages with APT"
xargs <~/dotfiles/packages/ubuntu.txt $apti
# NodeJS
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
$apti nodejs
# Erlang & Elixir
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb &&
sudo apt-get update &&
$apti esl-erlang &&
$apti elixir
# Windscribe
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key FDC247B7
echo 'deb https://repo.windscribe.com/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/windscribe-repo.list
sudo apt-get update && $apti windscribe-cli
}
installManjaroPackages() {
echo "==================================="
echo "Installing Manjaro packages..."
echo "==================================="
# Temporary aliases
pmi='sudo pacman -S --noconfirm --needed --quiet'
yai='yay -S --noconfirm --needed --quiet'
# Switch to testing branch
sudo pacman-mirrors --api --set-branch testing
sudo pacman-mirrors --fasttrack 5
# Perform a full upgrade
sudo pacman -Syyu
echo "Installing packages with Pacman"
$pmi - <~/dotfiles/packages/pacman.txt
sudo pacman -S --quiet pulseaudio-modules-bt <<<"y
y"
# Install packages with Yay
echo "Installing AUR packages with Yay:"
$yai - <~/dotfiles/packages/aur.txt
sudo systemctl enable windscribe
sudo systemctl enable spotifyd
}
installSnapPackages() {
echo "==================================="
echo "Installing Snap packages..."
echo "==================================="
case $os in
Ubuntu*)
sudo snap install opera
sudo snap install spotify
sudo snap install insomnia
sudo snap install postman
sudo snap install intellij-idea-community --classic
sudo snap install discord
sudo snap install slack --classic
sudo snap install sublime-text --classic
sudo snap install --edge uget
sudo snap install hub --classic
sudo snap install vlc
sudo snap install gnome-easytag
sudo snap install gitkraken
sudo snap install gimp
sudo snap install android-studio --classic &&
$apti libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
;;
Manjaro*) ;;
*)
echo "Unknown OS. Exiting..."
exit 1
;;
esac
}
installAndConfigureDocker() {
echo "==================================="
echo "Installing and configuring Docker..."
echo "==================================="
case $os in
Ubuntu*)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - &&
sudo add-apt-repository -y \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" &&
sudo apt-get update && $apti docker-ce
;;
Manjaro*)
sudo systemctl enable docker &&
sudo systemctl start docker
;;
*)
echo "Unknown OS. Exiting..."
exit 1
;;
esac
sudo docker run hello-world &&
sudo usermod -aG docker "$USER"
}
installNpmPackages() {
echo "==================================="
echo "Installing global npm and yarn packages"
echo "==================================="
cd ~/ || return
npm_packages='
vim-language-server
vscode-langservers-extracted
typescript
typescript-language-server
typescript-formatter
markdownlint-cli
fixjson
airpaste
bash-language-server'
yarn_packages='
diagnostic-languageserver
yaml-language-server'
echo "Installing the following global NPM packages: $npm_packages"
sudo npm i -g $npm_packages
echo "Installing the following global Yarn packages: $npm_packages"
yarn global add $yarn_packages
}
installLanguages() {
echo "==================================="
echo "Installing python, rust and haskell..."
echo "==================================="
# pipi='pip install --upgrade'
pipu='pip install --user --upgrade'
# Python & PIP
# pip_packages=''
# echo "Installing the following PIP packages in the system: $pip_packages"
# Installing packages
# sudo $pipi $pip_packages
pip_user_packages='
ipython
pynvim
vcspull
autopep8
pylint
pyright
taskwarrior-inthe.am
git+git://github.com/robgolding/tasklib@develop
vit
yq
vim-vint'
echo "Installing the following PIP packages for the current user: $pip_user_packages"
# Installing packages
$pipu $pip_user_packages
# Rust & Cargo
rustup toolchain install nightly
rustup default nightly
rustup install nightly-2016-08-01
rustup run nightly-2016-08-01 cargo install --git https://github.com/murarth/rusti
rustup component add rustfmt rls rust-analysis rust-src
cargo install just inputplug
# Haskell & Stack
stack install hlint apply-refact hindent hoogle
~/.local/bin/hoogle generate
# Go packages
go get github.com/edi9999/path-extractor/path-extractor
# Ruby gem
gem install solargraph
}
installFonts() {
echo "==================================="
echo "Installing fonts..."
echo "==================================="
cd ~/ || return
# Console fonts
git clone https://github.com/powerline/fonts.git &&
cd fonts &&
./install.sh &&
cd .. &&
rm -rf fonts
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts && curl -fLo "Noto Mono Nerd Font Complete Mono.ttf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Noto/Mono/complete/Noto%20Mono%20Nerd%20Font%20Complete%20Mono.ttf
}
cloneDotfiles() {
echo "==================================="
echo "Cloning dotfiles"
echo "==================================="
cd ~/ || return
if [[ ! -f ~/.ssh/id_rsa ]]; then
echo "SSH key not found"
exit 1
fi
git clone --recurse-submodule [email protected]:jfpedroza/dotfiles.git
cd dotfiles
./dotfiles.sh
}
setupVim() {
echo "==================================="
echo "Setting up vim and neovim"
echo "==================================="
cd ~/ || return
# Vim-plug for Vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall
ln -sf ~/Cloud/vimwiki ~/vimwiki
}
useZsh() {
echo "==================================="
echo "Setting ZSH as default shell"
echo "==================================="
cd ~/ || return
chsh -s "$(command -v zsh)"
REPO=jfpedroza/ohmyzsh sh -c "$(curl -fsSL https://raw.github.com/jfpedroza/ohmyzsh/master/tools/install.sh)"
zsh_custom=~/.oh-my-zsh/custom
cd ~/.oh-my-zsh
git remote set-url origin [email protected]:jfpedroza/ohmyzsh.git
# FZF extras
git clone https://github.com/atweiden/fzf-extras.git ~/.fzf-extras
cd ~/.fzf-extras || return
git checkout zsh
cd ~/dotfiles
./dotfiles.sh
}
setupScriptfs() {
echo "==================================="
echo "Cloning and building scriptfs"
echo "==================================="
mkdir -p ~/code/lib
git clone [email protected]:jfpedroza/scriptfs.git ~/code/lib/scriptfs
cd ~/code/lib/scriptfs
make
sudo cp scriptfs /usr/local/bin/scriptfs
}
createSymlinks() {
echo "==================================="
echo "Creating PCloud Symlinks"
echo "==================================="
cd ~/ || return
sudo mkdir /media
sudo chown "$USER" /media
mkdir -p Programming
# pCloud Symlinks
ln -s ~/Cloud/Documents ~/Documents/Cloud
ln -s ~/Cloud/Pictures ~/Pictures/Cloud
ln -s ~/Cloud/Programming ~/Programming/Cloud
}
install() {
echo "==================================="
echo "Beginning Installation..."
echo "==================================="
os=$(lsb_release -d | cut -f2)
cloneDotfiles
case $os in
Ubuntu*)
installUbuntuPackages
;;
Manjaro*)
installManjaroPackages
;;
*)
echo "Unknown OS. Exiting..."
exit 1
;;
esac
sudo mv /usr/bin/ksplashqml /usr/bin/ksplashqml.old
installSnapPackages
installAndConfigureDocker
installNpmPackages
installLanguages
installFonts
setupVim
useZsh
setupScriptfs
createSymlinks
}
install
# Changes in sudoers file with sudo -E visudo:
# Defaults passwd_timeout=0
# Defaults timestamp_timeout=30