-
Notifications
You must be signed in to change notification settings - Fork 3
/
mpi.sh
executable file
·432 lines (365 loc) · 10.9 KB
/
mpi.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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# !/bin/bash
# Missing package installer for (X)ubuntu 16.04 and 14.04.
# A simple script for installing some of the missing software (i like to use) on new systems
# 2017.04.24 by TRi
VER="0.5.2"
DIST_V="$(lsb_release -r -s)"
DIST_N="$(lsb_release -i -s)"
PKG_SYS="mc htop iftop conky imwheel curl keepassx gufw gparted p7zip-full bleachbit compton wmctrl kdocker terminator scrot redshift gtk-redshift synaptic aptitude cups csh lib32stdc++6"
PKG_DEV="build-essential gdb git tig python-pip monodevelop mono-runtime geany geany-common netbeans"
PKG_MEDIA="vlc soundconverter easytag sound-juicer libdvdread4 brasero ubuntu-restricted-extras"
PKG_OFFICE="pdfshuffler pdfchain libreoffice-impress"
PKG_LATEX="texstudio lyx lyx-common texlive texlive-lang-german"
PKG_INET="mumble corebird filezilla polari"
PKG_INET_14="mumble filezilla xchat-gnome"
PKG_GFX="imagemagick inkscape gimp xsane"
PKG_GAMES="wesnoth hedgewars gweled scummvm burgerspace"
PKG_ATOM_EXT="platformio-ide-terminal python-debugger language-haskell git-time-machine git-plus autocomplete-python pdf-view minimap project-manager language-vue bottom-dock gulp-manager todo-manager symbols-tree-view pigments language-ini highlight-selected minimap-highlight-selected rest-client"
NAME_SYSTEM="System"
NAME_DEV="Development"
NAME_MEDIA="Media"
NAME_OFFICE="Office"
NAME_LATEX="LaTeX"
NAME_INET="Internet"
NAME_GFX="Graphics"
NAME_GAMES="Games"
NAME_PPA_KODI="PPA-Kodi"
NAME_PPA_VLC="PPA-VLC"
NAME_PPA_JAVA="PPA-Java"
NAME_PPA_LIBREOFFICE="PPA-Libre"
NAME_PPA_GIT="PPA-Git"
NAME_PPA_ATOM="PPA-Atom"
NAME_PPA_HIPCHAT="PPA-HipChat"
NAME_PPA_PAPIRUS="PPA-Papirus"
NAME_EXT_RUST="Rust-Lang"
NAME_EXT_NODE="Node.js"
NAME_EXT_DOCKER="Docker"
NAME_SCRIPT_UPDATE="Update-Script"
NAME_SCRIPT_KERNEL="Kernel-Script"
##
# Updates the already installed packages.
##
function update_packages()
{
echo -e "\nGoing to update the system packages first"
sudo apt update && sudo apt upgrade -y
}
##
# Installes giving packages.
##
function install_packages()
{
echo -e "\nInstalling: $*"
sudo apt update && sudo apt install -y $*
}
##
# Installation of the system update script to /usr/bin/mkupdate.
##
function install_update_script()
{
echo -e "\nInstalling update script"
file_tmp="/tmp/mkupdate"
file_dst="/usr/bin/mkupdate"
apt_get="sudo apt update && sudo apt upgrade && sudo apt autoremove && sudo apt autoclean"
apt="sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove"
if [ -f "$file_tmp" ]
then
rm $file_tmp
fi
touch $file_tmp
echo -e "#!/bin/sh" >> $file_tmp
if [ $DIST_N == "Ubuntu" ]
then
if [ $DIST_V == "16.04" ]
then
echo -e $apt >> $file_tmp
elif [ $DIST_V == "14.04" ]
then
echo -e $apt_get >> $file_tmp
fi
elif [ $DIST_N == "LinuxMint" ]
then
if [ $DIST_V == "18" ]
then
echo -e $apt >> $file_tmp
else
echo -e $apt_get >> $file_tmp
fi
fi
if [ -f "$file_dst" ]
then
sudo rm $file_dst
fi
sudo cp $file_tmp $file_dst
sudo chmod a+x $file_dst
echo "Installation of update script complete. Run 'mkupdate'"
}
##
# Installation to the remove old kernel script to /usr/bin/remove-old-kernels.
##
function install_kernel_script()
{
echo -e "\nInstalling kernel script"
file_tmp="/tmp/remove-old-kernels"
file_dst="/usr/bin/remove-old-kernels"
if [ -f "$file_tmp" ]
then
rm $file_tmp
fi
touch $file_tmp
echo -e "#!/bin/sh" >> $file_tmp
echo -e "echo \$(dpkg --list | grep linux-image | awk '{ print \$2 }' | sort -V | sed -n '/'`uname -r`'/q;p') \$(dpkg --list | grep linux-headers | awk '{ print \$2 }' | sort -V | sed -n '/'\"\$(uname -r | sed \"s/\([0-9.-]*\)-\([^0-9]\+\)/\1/\")\"'/q;p') | xargs sudo apt-get -y purge" >> $file_tmp
if [ -f "$file_dst" ]
then
sudo rm $file_dst
fi
sudo cp $file_tmp $file_dst
sudo chmod a+x $file_dst
echo "Installation of script to remove old kernels complete. Run 'remove-old-kernels'"
}
##
# PPA: Install Kodi.
##
function install_PPA_Kodi()
{
echo -e "\nInstalling Kodi PPA"
sudo add-apt-repository ppa:team-xbmc/ppa -y
sudo apt update
sudo apt install -y kodi
echo "Kodi installed"
}
##
# PPA: Install VLC.
#
function install_PPA_VLC()
{
echo -e "\nInstalling VLC PPA"
sudo add-apt-repository ppa:videolan/stable-daily -y
sudo apt update
sudo apt install -y vlc
echo "VLC Player installed"
}
##
# PPA: Oracle Java.
##
function install_PPA_Java()
{
echo -e "\nInstalling JAVA PPA"
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt update
sudo apt install -y oracle-java8-installer
echo "Oracle Java 8 installed"
}
##
# PPA: LibreOffice.
##
function install_PPA_LibreOffice()
{
echo -e "\nInstalling LibreOffice PPA"
sudo add-apt-repository ppa:libreoffice/ppa -y
sudo apt update
sudo apt install -y libreoffice-writer libreoffice-calc libreoffice-draw libreoffice-math
echo "LibreOffice installed"
}
##
# PPA: Install Git.
##
function install_PPA_Git()
{
echo -e "\nInstalling Git PPA"
sudo add-apt-repository ppa:/git-core/ppa -y
sudo apt update
sudo apt install -y git
echo "Git installed"
}
##
# PPA: Install Atom.
##
function install_PPA_Atom()
{
echo -e "\nInstalling Atom PPA"
sudo add-apt-repository ppa:webupd8team/atom -y
sudo apt update
sudo apt install -y atom
echo -e "\nInstalling Atom extentions"
apm install $PKG_ATOM_EXT
echo "Atom installed"
}
##
# PPA: Atlassian HipChat 4
##
function install_PPA_HIPCHAT()
{
echo -e "\nInstalling Atlassian HipChat PPA"
sudo sh -c 'echo "deb https://atlassian.artifactoryonline.com/atlassian/hipchat-apt-client $(lsb_release -c -s) main" > /etc/apt/sources.list.d/atlassian-hipchat4.list'
wget -O - https://atlassian.artifactoryonline.com/atlassian/api/gpg/key/public | sudo apt-key add -
sudo apt update
sudo apt install -y hipchat4
echo "Atlassian HipChat installed"
}
##
# PPA: Papirus Icon Theme
##
function install_PPA_PAIRUS() {
echo -e "\nInstalling Papirus Icon Theme PPA"
sudo add-apt-repository ppa:papirus/papirus -y
sudo apt update
sudo apt install -y papirus-icon-theme
echo "Papirus Icon Theme installed"
}
##
# External: Rust lang installation.
##
function install_ext_rust()
{
echo -e "\nInstalling Rust Lang"
sudo apt update && sudo apt install -y curl
curl -sSf https://static.rust-lang.org/rustup.sh | sudo sh
echo "Rust installed"
}
##
# External: Node.js installation.
##
function install_ext_node()
{
echo -e "\nInstalling Node.js"
sudo apt update && sudo apt install -y curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt install -y nodejs
echo "Node.js insalled"
}
##
# External: Docker installation.
##
function install_ext_docker()
{
echo -e "\nInstalling Docker"
sudo apt install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
file_tmp="/tmp/docker.list"
file_dst="/etc/apt/sources.list.d/docker.list"
if [ -f "$file_tmp" ]
then
rm $file_tmp
fi
touch $file_tmp
if [ $DIST_N == "Ubuntu" ]
then
if [ $DIST_V == "16.04" ]
then
echo -e "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >> $file_tmp
elif [ $DIST_V == "14.04" ]
then
echo -e "deb https://apt.dockerproject.org/repo ubuntu-trusty main" >> $file_tmp
fi
elif [ $DIST_N == "LinuxMint" ]
then
if [ $DIST_V == "18" ]
then
echo -e "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >> $file_tmp
fi
fi
if [ -f "$file_dst" ]
then
sudo rm $file_dst
fi
sudo cp $file_tmp $file_dst
sudo apt update
sudo apt install -y docker-engine
sudo usermod -aG docker $USER
echo "Docker installed"
}
## Warning msg on start
if [ $DIST_N == "Ubuntu" ]
then
whiptail --title "Missing Package Installer V$VER" --msgbox "This script supports (x)ubuntu 16.04 and 14.04 at the moment.\nAnd as always: use at your own risk." 8 78
else
whiptail --title "Missing Package Installer V$VER" --msgbox "This script was tested only with (x)ubuntu 16.04 and 14.04 yet.\nIt may not work properly on other distribution.\n\nUse at your own risk." 10 78
fi
## Choose dialog
DISTROS=$(whiptail --title "Missing Package Installer V$VER" --checklist \
"Choose missing software packages to install" 27 66 21 \
$NAME_SYSTEM " - System core software" OFF \
$NAME_DEV " - Development software" OFF \
$NAME_MEDIA " - Multimedia software" OFF \
$NAME_OFFICE " - Office software" OFF \
$NAME_LATEX " - LaTeX software" OFF \
$NAME_INET " - Internet software" OFF \
$NAME_GFX " - Graphics software" OFF \
$NAME_GAMES " - Just some FOSS Games" OFF \
$NAME_PPA_JAVA " - Oracle Java 8" OFF \
$NAME_PPA_GIT " - The latest Git" OFF \
$NAME_PPA_LIBREOFFICE " - The latest LibreOffice" OFF \
$NAME_PPA_KODI " - The latest Kodi" OFF \
$NAME_PPA_VLC " - The latest VLC" OFF \
$NAME_PPA_ATOM " - Atom hackable text editor" OFF \
$NAME_PPA_HIPCHAT " - Atlassian HipChat4" OFF \
$NAME_PPA_PAPIRUS " - Papirus icon Theme" OFF \
$NAME_EXT_RUST " - Install Rust Language" OFF \
$NAME_EXT_NODE " - Install Node.js" OFF \
$NAME_EXT_DOCKER " - Install Docker" OFF \
$NAME_SCRIPT_UPDATE " - A system update script" OFF \
$NAME_SCRIPT_KERNEL " - A script to remove unused kernels " OFF \
3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
## Update the system first
update_packages
## Scripts
case "${DISTROS[@]}" in *$NAME_SCRIPT_UPDATE*)
install_update_script ;; esac
case "${DISTROS[@]}" in *$NAME_SCRIPT_KERNEL*)
install_kernel_script ;; esac
## Install main packages first
packages=""
case "${DISTROS[@]}" in *$NAME_SYSTEM*)
packages="$packages "$PKG_SYS ;; esac
case "${DISTROS[@]}" in *$NAME_MEDIA*)
packages="$packages "$PKG_MEDIA ;; esac
case "${DISTROS[@]}" in *$NAME_OFFICE*)
packages="$packages "$PKG_OFFICE ;; esac
case "${DISTROS[@]}" in *$NAME_LATEX*)
packages="$packages "$PKG_LATEX ;; esac
case "${DISTROS[@]}" in *$NAME_INET*)
if [ $DIST_V == "16.04" ]
then
packages="$packages "$PKG_INET
elif [ $DIST_V == "14.04" ]
then
packages="$packages "$PKG_INET_14
fi
;; esac
case "${DISTROS[@]}" in *$NAME_GFX*)
packages="$packages "$PKG_GFX ;; esac
case "${DISTROS[@]}" in *$NAME_GAMES*)
packages="$packages "$PKG_GAMES ;; esac
if [ ! -z "$packages" -a "$packages" != " " ]; then
install_packages $packages
fi
## PPAs
case "${DISTROS[@]}" in *$NAME_PPA_KODI*)
install_PPA_Kodi ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_VLC*)
install_PPA_VLC ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_JAVA*)
install_PPA_Java ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_LIBREOFFICE*)
install_PPA_LibreOffice ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_GIT*)
install_PPA_Git ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_ATOM*)
install_PPA_Atom ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_HIPCHAT*)
install_PPA_HIPCHAT ;; esac
case "${DISTROS[@]}" in *$NAME_PPA_PAPIRUS*)
install_PPA_PAIRUS ;; esac
## External
case "${DISTROS[@]}" in *$NAME_EXT_RUST*)
install_ext_rust ;; esac
case "${DISTROS[@]}" in *$NAME_EXT_NODE*)
install_ext_node ;; esac
case "${DISTROS[@]}" in *$NAME_EXT_DOCKER*)
install_ext_docker ;; esac
else
echo "Package installation aborted."
fi