-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·333 lines (282 loc) · 10.1 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
#!/bin/bash
if [ $# -eq 1 ]; then
logFile=$1
else
echo "You need provide a path for the log file (e.g. './install /tmp/dotfilesInstallLog.txt')"
exit 1
fi
############################
# DOING OPERATION FEEDBACK #
############################
showLoading() {
myPid=$!
loadingText=$1
eraseToEndOfLine="\r\033[K"
greenCheck="\e[1;32m\xE2\x9C\x94\e[0m"
echo -ne "$loadingText\r"
while kill -0 $myPid 2>/dev/null; do
echo -ne "$loadingText.\r"
sleep 0.5
echo -ne "$loadingText..\r"
sleep 0.5
echo -ne "$loadingText...\r"
sleep 0.5
echo -ne "$eraseToEndOfLine"
echo -ne "$loadingText\r"
sleep 0.5
done
echo -e "$loadingText $greenCheck"
}
#################
# SYSTEM UPDATE #
#################
systemUpdate() {
sudo apt-get update &>> $logFile
sudo apt-get upgrade -y &>> $logFile
sudo apt-get autoremove -y &>> $logFile
sudo apt-get autoclean &>> $logFile
}
#############################
# INSTALLING BASIC PACKAGES #
#############################
installGit() {
sudo apt-get install -y git >> $logFile
}
installVim() {
sudo apt-get install -y vim >> $logFile
}
installCurl() {
sudo apt-get install -y curl >> $logFile
}
installAutojump() {
sudo apt-get install -y autojump >> $logFile
}
installFzf() {
sudo apt-get install -y fzf >> $logFile
}
installZsh() {
sudo apt-get install -y zsh >> $logFile
}
installDocker() {
sudo apt-get install -y apt-transport-https ca-certificates gnupg-agent software-properties-common >> $logFile
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - &>> $logFile
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" >> $logFile
sudo apt-get update >> $logFile
sudo apt-get install -y docker-ce docker-ce-cli containerd.io >> $logFile
sudo usermod -aG docker $USER
}
installDockerCompose() {
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose &>> $logFile
sudo chmod +x /usr/local/bin/docker-compose
}
installNvm() {
wget -qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash &>> $logFile
}
installYarn() {
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - &>> $logFile
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list >> $logFile
sudo apt-get update >> $logFile
sudo apt-get install -y yarn >> $logFile
}
installLatex() {
sudo apt-get install -y texlive &>> $logFile
}
installPip() {
sudo apt-get install -y python-pip &>> $logFile
sudo apt-get install -y python3-pip &>> $logFile
}
installVirtualenv() {
sudo apt-get install -y virtualenv >> $logFile
}
installFlutter() {
git clone https://github.com/flutter/flutter.git -b stable $HOME/development/devtools/flutter-sdk &>> $logFile
}
installPhp() {
sudo add-apt-repository ppa:ondrej/php -y &>> $logFile
sudo apt-get update &>> $logFile
sudo apt-get install -y php php-xml php-curl &>> $logFile
}
installComposer() {
sudo apt-get install -y php-cli php-mbstring &>> $logFile
sudo curl -s https://getcomposer.org/installer | php &>> $logFile
sudo mv composer.phar /usr/local/bin/composer
}
installSymfony() {
wget -q https://get.symfony.com/cli/installer -O - | bash &>> $logFile
}
installOpenJDKs() {
sudo apt-get install -y openjdk-8-jdk >> $logFile
sudo apt-get install -y openjdk-11-jdk >> $logFile
}
installYouTubeDL() {
sudo curl -sL https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
}
installTelegram() {
wget https://telegram.org/dl/desktop/linux -O /tmp/telegram.tar.xz &>> $logFile
tar -C /tmp/ -xvf /tmp/telegram.tar.xz >> $logFile
if [ ! -d /opt/Telegram ]; then
sudo mv /tmp/Telegram /opt/
fi
}
installFranz() {
wget https://github.com/meetfranz/franz/releases/download/v5.4.0/franz_5.4.0_amd64.deb -O /tmp/franz.deb &>> $logFile
sudo dpkg -i /tmp/franz.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
}
installSpotify() {
curl -sS https://download.spotify.com/debian/pubkey.gpg | sudo apt-key add - &>> $logFile
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list >> $logFile
sudo apt-get update >> $logFile
sudo apt-get install -y spotify-client-gnome-support >> $logFile
}
installMegaSync() {
megaUrl=https://mega.nz/linux/MEGAsync/xUbuntu_$(lsb_release -sr)/amd64
wget $megaUrl/megasync-xUbuntu_$(lsb_release -sr)_amd64.deb -O /tmp/megasync.deb &>> $logFile
sudo dpkg -i /tmp/megasync.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
wget $megaUrl/nautilus-megasync-xUbuntu_$(lsb_release -sr)_amd64.deb -O /tmp/megasync-extension.deb &>> $logFile
sudo dpkg -i /tmp/megasync-extension.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
}
installTilda() {
sudo apt-get install -y tilda >> $logFile
}
installDropbox() {
wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2020.03.04_amd64.deb -O /tmp/dropbox.deb &>> $logFile
sudo dpkg -i /tmp/dropbox.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
}
installVSCode() {
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /tmp/vscode.deb &>> $logFile
sudo dpkg -i /tmp/vscode.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
}
installDiscord() {
wget -O /tmp/discord.deb https://discordapp.com/api/download?platform=linux&format=deb &>> $logFile
sudo dpkg -i /tmp/discord.deb &>> $logFile
sudo apt-get install -f -y >> $logFile
}
installJetBrainsToolBox() {
wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.16.6319.tar.gz -O /tmp/jetbrains-toolbox.tar.gz &>> $logFile
tar -C /tmp/ -zxvf /tmp/jetbrains-toolbox.tar.gz >> $logFile
if [ ! -f /usr/local/bin/jetbrains-toolbox-1.16.6319 ]; then
sudo mv /tmp/jetbrains-toolbox-1.16.6319/jetbrains-toolbox /usr/local/bin
fi
}
##########################
# EXTENSIONS AND PLUGINS #
##########################
installOhMyZsh() {
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O /tmp/install-oh-my-zsh.sh &>> $logFile
bash /tmp/install-oh-my-zsh.sh --unattended &>> $logFile
# Installing xclip for copydir and copyfile extensions
sudo apt-get install -y xclip >> $logFile
}
installTheFuck() {
sudo apt-get install -y python3-dev python3-pip python3-setuptools >> $logFile
sudo -H pip3 install thefuck >> $logFile
}
installNerdTree() {
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/pack/vendor/start/nerdtree &>> $logFile
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q &>> $logFile
}
installFiraCode() {
sudo apt-get install -y fonts-firacode >> $logFile
}
installPapirus() {
sudo add-apt-repository ppa:papirus/papirus -y &>> $logFile
sudo apt-get update &>> $logFile
sudo apt-get install -y papirus-icon-theme &>> $logFile
}
installPaper() {
sudo add-apt-repository -u ppa:snwh/ppa -y &>> $logFile
sudo apt-get update &>> $logFile
sudo apt install -y paper-icon-theme &>> $logFile
}
createNewSshKey() {
rm -rf ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
ssh-keygen -t rsa -b 4096
sshKey=$(cat ~/.ssh/id_rsa.pub)
read -s -p "Enter a personal acces token token with 'write:public_key' scope (https://github.com/settings/tokens): " githubToken
curl -i --header "Authorization: token $githubToken" --data "{\"title\": \"$(hostname)\", \"key\": \"$sshKey\"}" https://api.github.com/user/keys &>> $logFile
echo
yes | ssh -T [email protected] >> $logFile
}
##########
# OTHERS #
##########
developmentFolderStructure() {
mkdir -p $HOME/development
mkdir -p $HOME/development/devtools
mkdir -p $HOME/development/repositories
mkdir -p $HOME/development/repositories/sideprojects
mkdir -p $HOME/development/repositories/codekatas
mkdir -p $HOME/development/repositories/asl
mkdir -p $HOME/development/repositories/university
}
cloneDotfiles() {
git clone --recurse-submodules -j8 [email protected]:Pablorg99/dotfiles.git $HOME/dotfiles &>> $logFile
}
createShortcuts() {
sudo ln -sfn $HOME/dotfiles/shortcuts/robomongo.desktop /usr/share/applications/robomongo.desktop
}
# ASK SUDO PASSWORD
sudo ls . > $logFile
# SYSTEM UPDATE
systemUpdate & showLoading "SYSTEM UPDATE"
# INSTALLING BASIC PACKAGES
echo -e "INSTALLING BASIC PACKAGES"
installGit & showLoading "Git"
installVim & showLoading "Vim"
installZsh & showLoading "Zsh"
installCurl & showLoading "Curl"
installAutojump & showLoading "Autojump"
installFzf & showLoading "Fzf"
installDocker & showLoading "Docker"
installDockerCompose & showLoading "Docker-Compose"
installNvm & showLoading "Nvm"
installYarn & showLoading "Yarn"
installLatex & showLoading "LaTeX"
installPip & showLoading "Pip"
installVirtualenv & showLoading "Virtualenv"
installFlutter & showLoading "Flutter"
installPhp & showLoading "Php"
installComposer & showLoading "Composer"
installSymfony & showLoading "Symfony"
installOpenJDKs & showLoading "OpenJDKs"
installYouTubeDL & showLoading "YouTube-DL"
installTelegram & showLoading "Telegram"
installFranz & showLoading "Franz"
installSpotify & showLoading "Spotify"
installMegaSync & showLoading "MegaSync"
installTilda & showLoading "Tilda"
installVSCode & showLoading "VSCode"
installDiscord & showLoading "Discord"
installDropbox & showLoading "Dropbox"
installJetBrainsToolBox & showLoading "JetBrains ToolBox"
# ADDING SSH KEY TO GITHUB
echo "SSH KEY FOR GITHUB"
read -p "Dou you want to create a ssh key and link it to GitHub? [y/N] " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
createNewSshKey
fi
# THEMES AND EXTENSIONS
echo "INSTALLING EXTENSIONS AND PLUGINS"
installOhMyZsh & showLoading "Oh My Zsh"
installTheFuck & showLoading "TheFuck"
installNerdTree & showLoading "NerdTree"
installFiraCode & showLoading "Fira Code"
installPapirus & showLoading "Papirus Icons"
installPaper & showLoading "Paper Icons"
# DEVELOPMENT FOLDER STRUCTURE AND DOTFILES
echo "OTHERS"
developmentFolderStructure & showLoading "Development Folder"
cloneDotfiles & showLoading "Cloning Dotfiles"
createShortcuts & showLoading "Shortcuts"
# SHELL CONFIGURATION
sudo chsh -s /bin/zsh $USER
zsh "$HOME/dotfiles/update.sh"
exec zsh