-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·277 lines (255 loc) · 7.99 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
#!/bin/bash
# This script is part of Ahora © Plateform
#
# \details System : Vera GUI
# Component Name : vera
# Status : Version 1.0.0 Release 1
# Language : C++
#
# Platform Dependencies: GNU/Linux, Windows, MacOS
#
# \copyright GPLv3+ : GNU GPL version 3 or later
# Licencied Material - Property of IMT ATLANTIQUE
# © Copyright - UHA - ENSISA 2020
#
# \author Hethsron Jedaël BOUEYA ([email protected])
#
# \bug No known bug to date
# \date 21th May 2020
#
# This text plain is developed in the hope that it will be useful
# but WITHOUT ANY WARRANTY ; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Default flags
ERROR="[\033[31m!\033[0m]"
DEBUG="[\033[33m#\033[0m]"
OK="[\033[32mo\033[0m]"
# By default PREROGATIVE is set to sudo for normal users
if [[ $USER = root ]]; then
export PREROGATIVE=
else
export PREROGATIVE=sudo
fi
# Default commands
ECHO="echo -e"
# Check GNU/Linux distribtion function
function checkDistrib() {
DISTRIB=$(cat /etc/os-release | grep "NAME" | head -n 1 | cut -d'"' -f2 | cut -d' ' -f1)
if [[ "$DISTRIB" = "CentOS" ]]; then
# Define appropriate download manager for CentOS Distribution
DOWN_MANAG="yum"
PKG_MANAG="rpm"
elif [[ "$DISTRIB" = "Debian" ]] || [[ "$DISTRIB" = "Kali" ]]; then
# Define appropriate download manager for Debian Like Distribution
DOWN_MANAG="apt-get"
PKG_MANAG="dpkg-query"
elif [[ "$DISTRIB" = "Mageia" ]]; then
# Define appropriate download manager for Mageia Distribution
DOWN_MANAG="urpmi"
PKG_MANAG="rpm"
elif [[ "$DISTRIB" = "Arch" ]]; then
# Define appropriate download manager for Arch Linux Distribution
DOWN_MANAG="pacman"
PKG_MANAG="pacman"
else
return 1
fi
}
# Install missing package functions
function installMissingPKG() {
if [ -z "$1" ]; then
${ECHO} "${ERROR} \$PKG is empty"
else
COMMAND=$(${PKG_MANAG} -W -f='${Status}\n' $1 | cut -d' ' -f1)
if [[ "$COMMAND" = "install" ]]; then
${ECHO} "${OK} $1 is installed"
sleep 1
else
${ECHO} "${ERROR} $1 is not installed"
sleep 2
${ECHO} "${DEBUG} Installation of $1 ..."
${PREROGATIVE} ${DOWN_MANAG} install -y $1 > /dev/null
sleep 2
${ECHO} "${OK} $1 has been installed"
fi
fi
}
function installMissingPKGBUILD() {
if [ -z "$1" ]; then
echo "\$PKG is empty"
else
COMMAND=$(${PKG_MANAG} -Qi $1)
if [ -z "$COMMAND" ]; then
${ECHO} "${ERROR} $1 is not installed"
sleep 2
${ECHO} "${DEBUG} Installation of $1 ..."
${PREROGATIVE} ${DOWN_MANAG} -Syy $1 > /dev/null
sleep 2
${ECHO} "${OK} $1 has been installed"
else
${ECHO} "${OK} $1 is installed"
sleep 1
fi
fi
}
function installMissingRPM() {
if [ -z "$1" ]; then
echo "\$PKG is empty"
else
export NUX=nux-dextop-release
FIREWALL=$(${PKG_MANAG} -qa ${NUX})
if [ -z "$FIREWALL" ]; then
${ECHO} "${ERROR} ${NUX} is not installed"
sleep 2
${ECHO} "${DEBUG} Installation of ${NUX} ..."
# Load missing repositories
${PREROGATIVE} ${PKG_MANAG} --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
${PREROGATIVE} ${PKG_MANAG} -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm > /dev/null
# Uploading repositories
${PREROGATIVE} ${DOWN_MANAG} update -y > /dev/null
fi
COMMAND=$(${PKG_MANAG} -qa $1)
if [ -z "$COMMAND" ]; then
${ECHO} "${ERROR} $1 is not installed"
sleep 2
${ECHO} "${DEBUG} Installation of $1 ..."
${PREROGATIVE} ${DOWN_MANAG} install -y $1 > /dev/null
sleep 2
${ECHO} "${OK} $1 has been installed"
else
${ECHO} "${OK} $1 is installed"
sleep 1
fi
fi
}
# String arrays of packages
declare -a PKGS_CENTOS=(
"build-essential"
"cmake3"
"doxygen"
"gcc"
"gcc-c++"
"git"
"make"
"qtcreator"
)
declare -a PKGS_DEBIAN=(
"build-essential"
"cmake"
"doxygen"
"gcc"
"g++"
"git"
"make"
"qtbase5-dev"
"qtdeclarative5-dev"
"qtmultimedia5-dev"
"qt3d5-dev"
)
declare -a PKGS_KALI=(
"build-essential"
"cmake"
"doxygen"
"gcc"
"g++"
"git"
"make"
"qtbase5-dev"
"qtdeclarative5-dev"
"qtmultimedia5-dev"
"qt3d5-dev"
)
declare -a PKGS_MAGEIA=(
"cmake"
"gcc"
"gcc-c++"
"git"
"make"
)
declare -a PKGS_ARCH=(
"cmake"
"gcc"
"make"
"git"
"qt5-3d"
"qt5-base"
"qt5-charts"
"qt5-connectivity"
"qt5-datavis3d"
"qt5-declarative"
"qt5-doc"
"qt5-examples"
"qt5-gamepad"
"qt5-graphicaleffects"
"qt5-imageformats"
"qt5-location"
"qt5-lottie"
"qt5-multimedia"
"qt5-networkauth"
"qt5-purchasing"
"qt5-quick3d"
"qt5-quickcontrols"
"qt5-quickcontrols2"
"qt5-quicktimeline"
"qt5-remoteobjects"
"qt5-script"
"qt5-scxml"
"qt5-sensors"
"qt5-serialbus"
"qt5-serialport"
"qt5-speech"
"qt5-svg"
"qt5-tools"
"qt5-translations"
"qt5-virtualkeyboard"
"qt5-wayland"
"qt5-webchannel"
"qt5-webengine"
"qt5-webglplugin"
"qt5-websockets"
"qt5-webview"
"qt5-x11extras"
"qt5-xmlpatterns"
"doxygen"
"graphviz"
"dot2tex"
"python-graphviz"
"python-pydot"
)
# Display Welcome message
${ECHO} "Vera © Plateform"
${ECHO} "GPLv3+ : GNU GPL version 3 or later"
${ECHO} "Licencied Material - Property of IMT ATLANTIQUE"
${ECHO} "© Copyright - UHA - ENSISA 2020\n"
${ECHO} "Starting the configuration of your GNU/Linux Operating System"
${ECHO} ""
# Execute Check GNU/Linux distribtion function
checkDistrib
if [[ "$DISTRIB" = "CentOS" ]]; then
# Loop list of packages
for PKG in "${PKGS_CENTOS[@]}"; do
# Execute Install missing package function
installMissingRPM ${PKG}
done
elif [[ "$DISTRIB" = "Debian" ]]; then
# Loop list of pakages
for PKG in "${PKGS_DEBIAN[@]}"; do
# Execute Install missing package function
installMissingPKG ${PKG}
done
elif [[ "$DISTRIB" = "Kali" ]]; then
# Loop list of pakages
for PKG in "${PKGS_KALI[@]}"; do
# Execute Install missing package function
installMissingPKG ${PKG}
done
elif [[ "$DISTRIB" = "Arch" ]]; then
# Loop list of pakages
for PKG in "${PKGS_ARCH[@]}"; do
# Execute Install missing package function
installMissingPKGBUILD ${PKG}
done
fi
${ECHO} ""
${ECHO} "Configuration done"