1 | #!/bin/bash |
---|
2 | |
---|
3 | ##################################################################### |
---|
4 | ####### Script instalador OpenGnsys |
---|
5 | ####### autor: Luis Guillén <lguillen@unizar.es> |
---|
6 | ##################################################################### |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | #### AVISO: Editar configuración de acceso por defecto a la Base de Datos. |
---|
11 | MYSQL_ROOT_PASSWORD="passwordroot" # Clave root de MySQL |
---|
12 | OPENGNSYS_DATABASE="ogAdmBD" # Nombre de la base datos |
---|
13 | OPENGNSYS_DB_USER="usuog" # Usuario de acceso |
---|
14 | OPENGNSYS_DB_PASSWD="passusuog" # Clave del usuario |
---|
15 | |
---|
16 | #### AVISO: NO EDITAR. |
---|
17 | #### configuración de acceso smb para clientes OG. |
---|
18 | OPENGNSYS_CLIENT_USER="opengnsys" # Nombre del usuario |
---|
19 | OPENGNSYS_CLIENT_PASSWD="og" # Clave del usuario opengnsys |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | # Sólo ejecutable por usuario root |
---|
24 | if [ "$(whoami)" != 'root' ] |
---|
25 | then |
---|
26 | echo "ERROR: this program must run under root privileges!!" |
---|
27 | exit 1 |
---|
28 | fi |
---|
29 | |
---|
30 | # Detectar sistema operativo del servidor (debe soportar LSB). |
---|
31 | OSDISTRIB=$(lsb_release -is 2>/dev/null) |
---|
32 | # Array con las dependencias que deben estar instaladas, según de la distribución detectada. |
---|
33 | case "$OSDISTRIB" in |
---|
34 | Ubuntu) DEPENDENCIES=( subversion apache2 php5 libapache2-mod-php5 mysql-server php5-mysql nfs-kernel-server dhcp3-server bittorrent tftp-hpa tftpd-hpa syslinux openbsd-inetd update-inetd build-essential g++-multilib libmysqlclient15-dev wget doxygen graphviz bittornado ctorrent samba unzip netpipes debootstrap schroot squashfs-tools ) |
---|
35 | ;; |
---|
36 | *) echo "ERROR: Distribution not supported by OpenGnSys." |
---|
37 | exit 1 ;; |
---|
38 | esac |
---|
39 | |
---|
40 | # Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). |
---|
41 | PROGRAMDIR=$(readlink -e $(dirname "$0")) |
---|
42 | OPENGNSYS_SERVER="www.opengnsys.es" |
---|
43 | if [ -d "$PROGRAMDIR/../installer" ]; then |
---|
44 | USESVN=0 |
---|
45 | else |
---|
46 | USESVN=1 |
---|
47 | fi |
---|
48 | SVN_URL="http://$OPENGNSYS_SERVER/svn/branches/version1.0/" |
---|
49 | |
---|
50 | WORKDIR=/tmp/opengnsys_installer |
---|
51 | mkdir -p $WORKDIR |
---|
52 | |
---|
53 | INSTALL_TARGET=/opt/opengnsys |
---|
54 | LOG_FILE=/tmp/opengnsys_installation.log |
---|
55 | |
---|
56 | # Base de datos |
---|
57 | OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/ogAdmBD.sql |
---|
58 | |
---|
59 | |
---|
60 | ##################################################################### |
---|
61 | ####### Algunas funciones útiles de propósito general: |
---|
62 | ##################################################################### |
---|
63 | function getDateTime() |
---|
64 | { |
---|
65 | date "+%Y%m%d-%H%M%S" |
---|
66 | } |
---|
67 | |
---|
68 | # Escribe a fichero y muestra por pantalla |
---|
69 | function echoAndLog() |
---|
70 | { |
---|
71 | echo "$1" |
---|
72 | FECHAHORA=`getDateTime` |
---|
73 | echo "$FECHAHORA;$SSH_CLIENT;$1" >> $LOG_FILE |
---|
74 | } |
---|
75 | |
---|
76 | function errorAndLog() |
---|
77 | { |
---|
78 | echo "ERROR: $1" |
---|
79 | FECHAHORA=`getDateTime` |
---|
80 | echo "$FECHAHORA;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE |
---|
81 | } |
---|
82 | |
---|
83 | # comprueba si el elemento pasado en $2 esta en el array $1 |
---|
84 | function isInArray() |
---|
85 | { |
---|
86 | if [ $# -ne 2 ]; then |
---|
87 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
88 | exit 1 |
---|
89 | fi |
---|
90 | |
---|
91 | echoAndLog "${FUNCNAME}(): checking if $2 is in $1" |
---|
92 | local deps |
---|
93 | eval "deps=( \"\${$1[@]}\" )" |
---|
94 | elemento=$2 |
---|
95 | |
---|
96 | local is_in_array=1 |
---|
97 | # copia local del array del parametro 1 |
---|
98 | for (( i = 0 ; i < ${#deps[@]} ; i++ )) |
---|
99 | do |
---|
100 | if [ "${deps[$i]}" = "${elemento}" ]; then |
---|
101 | echoAndLog "isInArray(): $elemento found in array" |
---|
102 | is_in_array=0 |
---|
103 | fi |
---|
104 | done |
---|
105 | |
---|
106 | if [ $is_in_array -ne 0 ]; then |
---|
107 | echoAndLog "${FUNCNAME}(): $elemento NOT found in array" |
---|
108 | fi |
---|
109 | |
---|
110 | return $is_in_array |
---|
111 | |
---|
112 | } |
---|
113 | |
---|
114 | ##################################################################### |
---|
115 | ####### Funciones de manejo de paquetes Debian |
---|
116 | ##################################################################### |
---|
117 | |
---|
118 | function checkPackage() |
---|
119 | { |
---|
120 | package=$1 |
---|
121 | if [ -z $package ]; then |
---|
122 | errorAndLog "${FUNCNAME}(): parameter required" |
---|
123 | exit 1 |
---|
124 | fi |
---|
125 | echoAndLog "${FUNCNAME}(): checking if package $package exists" |
---|
126 | dpkg -s $package &>/dev/null | grep Status | grep -qw install |
---|
127 | if [ $? -eq 0 ]; then |
---|
128 | echoAndLog "${FUNCNAME}(): package $package exists" |
---|
129 | return 0 |
---|
130 | else |
---|
131 | echoAndLog "${FUNCNAME}(): package $package doesn't exists" |
---|
132 | return 1 |
---|
133 | fi |
---|
134 | } |
---|
135 | |
---|
136 | # recibe array con dependencias |
---|
137 | # por referencia deja un array con las dependencias no resueltas |
---|
138 | # devuelve 1 si hay alguna dependencia no resuelta |
---|
139 | function checkDependencies() |
---|
140 | { |
---|
141 | if [ $# -ne 2 ]; then |
---|
142 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
143 | exit 1 |
---|
144 | fi |
---|
145 | |
---|
146 | echoAndLog "${FUNCNAME}(): checking dependences" |
---|
147 | uncompletedeps=0 |
---|
148 | |
---|
149 | # copia local del array del parametro 1 |
---|
150 | local deps |
---|
151 | eval "deps=( \"\${$1[@]}\" )" |
---|
152 | |
---|
153 | declare -a local_notinstalled |
---|
154 | |
---|
155 | for (( i = 0 ; i < ${#deps[@]} ; i++ )) |
---|
156 | do |
---|
157 | checkPackage ${deps[$i]} |
---|
158 | if [ $? -ne 0 ]; then |
---|
159 | local_notinstalled[$uncompletedeps]=$package |
---|
160 | let uncompletedeps=uncompletedeps+1 |
---|
161 | fi |
---|
162 | done |
---|
163 | |
---|
164 | # relleno el array especificado en $2 por referencia |
---|
165 | for (( i = 0 ; i < ${#local_notinstalled[@]} ; i++ )) |
---|
166 | do |
---|
167 | eval "${2}[$i]=${local_notinstalled[$i]}" |
---|
168 | done |
---|
169 | |
---|
170 | # retorna el numero de paquetes no resueltos |
---|
171 | echoAndLog "${FUNCNAME}(): dependencies uncompleted: $uncompletedeps" |
---|
172 | return $uncompletedeps |
---|
173 | } |
---|
174 | |
---|
175 | # Recibe un array con las dependencias y lo instala |
---|
176 | function installDependencies() |
---|
177 | { |
---|
178 | if [ $# -ne 1 ]; then |
---|
179 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
180 | exit 1 |
---|
181 | fi |
---|
182 | echoAndLog "${FUNCNAME}(): installing uncompleted dependencies" |
---|
183 | |
---|
184 | # copia local del array del parametro 1 |
---|
185 | local deps |
---|
186 | eval "deps=( \"\${$1[@]}\" )" |
---|
187 | |
---|
188 | local string_deps="" |
---|
189 | for (( i = 0 ; i < ${#deps[@]} ; i++ )) |
---|
190 | do |
---|
191 | string_deps="$string_deps ${deps[$i]}" |
---|
192 | done |
---|
193 | |
---|
194 | if [ -z "${string_deps}" ]; then |
---|
195 | errorAndLog "${FUNCNAME}(): array of dependeces is empty" |
---|
196 | exit 1 |
---|
197 | fi |
---|
198 | |
---|
199 | OLD_DEBIAN_FRONTEND=$DEBIAN_FRONTEND |
---|
200 | export DEBIAN_FRONTEND=noninteractive |
---|
201 | |
---|
202 | echoAndLog "${FUNCNAME}(): now ${string_deps} will be installed" |
---|
203 | apt-get -y install --force-yes ${string_deps} |
---|
204 | if [ $? -ne 0 ]; then |
---|
205 | errorAndLog "${FUNCNAME}(): error installing dependencies" |
---|
206 | return 1 |
---|
207 | fi |
---|
208 | |
---|
209 | DEBIAN_FRONTEND=$OLD_DEBIAN_FRONTEND |
---|
210 | echoAndLog "${FUNCNAME}(): dependencies installed" |
---|
211 | } |
---|
212 | |
---|
213 | # Hace un backup del fichero pasado por parámetro |
---|
214 | # deja un -last y uno para el día |
---|
215 | function backupFile() |
---|
216 | { |
---|
217 | if [ $# -ne 1 ]; then |
---|
218 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
219 | exit 1 |
---|
220 | fi |
---|
221 | |
---|
222 | local fichero=$1 |
---|
223 | local fecha=`date +%Y%m%d` |
---|
224 | |
---|
225 | if [ ! -f $fichero ]; then |
---|
226 | errorAndLog "${FUNCNAME}(): file $fichero doesn't exists" |
---|
227 | return 1 |
---|
228 | fi |
---|
229 | |
---|
230 | echoAndLog "${FUNCNAME}(): realizando backup de $fichero" |
---|
231 | |
---|
232 | # realiza una copia de la última configuración como last |
---|
233 | cp -p $fichero "${fichero}-LAST" |
---|
234 | |
---|
235 | # si para el día no hay backup lo hace, sino no |
---|
236 | if [ ! -f "${fichero}-${fecha}" ]; then |
---|
237 | cp -p $fichero "${fichero}-${fecha}" |
---|
238 | fi |
---|
239 | |
---|
240 | echoAndLog "${FUNCNAME}(): backup realizado" |
---|
241 | } |
---|
242 | |
---|
243 | ##################################################################### |
---|
244 | ####### Funciones para el manejo de bases de datos |
---|
245 | ##################################################################### |
---|
246 | |
---|
247 | # This function set password to root |
---|
248 | function mysqlSetRootPassword() |
---|
249 | { |
---|
250 | if [ $# -ne 1 ]; then |
---|
251 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
252 | exit 1 |
---|
253 | fi |
---|
254 | |
---|
255 | local root_mysql="$1" |
---|
256 | echoAndLog "${FUNCNAME}(): setting root password in MySQL server" |
---|
257 | mysqladmin -u root password "$root_mysql" |
---|
258 | if [ $? -ne 0 ]; then |
---|
259 | errorAndLog "${FUNCNAME}(): error while setting root password in MySQL server" |
---|
260 | return 1 |
---|
261 | fi |
---|
262 | echoAndLog "${FUNCNAME}(): root password saved!" |
---|
263 | return 0 |
---|
264 | } |
---|
265 | |
---|
266 | # Si el servicio mysql esta ya instalado cambia la variable de la clave del root por la ya existente |
---|
267 | function mysqlGetRootPassword() |
---|
268 | { |
---|
269 | local pass_mysql |
---|
270 | local pass_mysql2 |
---|
271 | # Comprobar si MySQL está instalado con la clave de root por defecto. |
---|
272 | if mysql -u root -p"$MYSQL_ROOT_PASSWORD" <<<"quit" 2>/dev/null; then |
---|
273 | echoAndLog "${FUNCNAME}(): Using default mysql root password." |
---|
274 | else |
---|
275 | stty -echo |
---|
276 | echo "There is a MySQL service already installed." |
---|
277 | read -p "Enter MySQL root password: " pass_mysql |
---|
278 | echo "" |
---|
279 | read -p "Confrim password:" pass_mysql2 |
---|
280 | echo "" |
---|
281 | stty echo |
---|
282 | if [ "$pass_mysql" == "$pass_mysql2" ] ;then |
---|
283 | MYSQL_ROOT_PASSWORD="$pass_mysql" |
---|
284 | return 0 |
---|
285 | else |
---|
286 | echo "The keys don't match. Do not configure the server's key," |
---|
287 | echo "transactions in the database will give error." |
---|
288 | return 1 |
---|
289 | fi |
---|
290 | fi |
---|
291 | } |
---|
292 | |
---|
293 | # comprueba si puede conectar con mysql con el usuario root |
---|
294 | function mysqlTestConnection() |
---|
295 | { |
---|
296 | if [ $# -ne 1 ]; then |
---|
297 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
298 | exit 1 |
---|
299 | fi |
---|
300 | |
---|
301 | local root_password="${1}" |
---|
302 | echoAndLog "${FUNCNAME}(): checking connection to mysql..." |
---|
303 | echo "" | mysql -uroot -p"${root_password}" |
---|
304 | if [ $? -ne 0 ]; then |
---|
305 | errorAndLog "${FUNCNAME}(): connection to mysql failed, check root password and if daemon is running!" |
---|
306 | return 1 |
---|
307 | else |
---|
308 | echoAndLog "${FUNCNAME}(): connection success" |
---|
309 | return 0 |
---|
310 | fi |
---|
311 | } |
---|
312 | |
---|
313 | # comprueba si la base de datos existe |
---|
314 | function mysqlDbExists() |
---|
315 | { |
---|
316 | if [ $# -ne 2 ]; then |
---|
317 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
318 | exit 1 |
---|
319 | fi |
---|
320 | |
---|
321 | local root_password="${1}" |
---|
322 | local database=$2 |
---|
323 | echoAndLog "${FUNCNAME}(): checking if $database exists..." |
---|
324 | echo "show databases" | mysql -uroot -p"${root_password}" | grep "^${database}$" |
---|
325 | if [ $? -ne 0 ]; then |
---|
326 | echoAndLog "${FUNCNAME}():database $database doesn't exists" |
---|
327 | return 1 |
---|
328 | else |
---|
329 | echoAndLog "${FUNCNAME}():database $database exists" |
---|
330 | return 0 |
---|
331 | fi |
---|
332 | } |
---|
333 | |
---|
334 | function mysqlCheckDbIsEmpty() |
---|
335 | { |
---|
336 | if [ $# -ne 2 ]; then |
---|
337 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
338 | exit 1 |
---|
339 | fi |
---|
340 | |
---|
341 | local root_password="${1}" |
---|
342 | local database=$2 |
---|
343 | echoAndLog "${FUNCNAME}(): checking if $database is empty..." |
---|
344 | num_tablas=`echo "show tables" | mysql -uroot -p"${root_password}" "${database}" | wc -l` |
---|
345 | if [ $? -ne 0 ]; then |
---|
346 | errorAndLog "${FUNCNAME}(): error executing query, check database and root password" |
---|
347 | exit 1 |
---|
348 | fi |
---|
349 | |
---|
350 | if [ $num_tablas -eq 0 ]; then |
---|
351 | echoAndLog "${FUNCNAME}():database $database is empty" |
---|
352 | return 0 |
---|
353 | else |
---|
354 | echoAndLog "${FUNCNAME}():database $database has tables" |
---|
355 | return 1 |
---|
356 | fi |
---|
357 | |
---|
358 | } |
---|
359 | |
---|
360 | |
---|
361 | function mysqlImportSqlFileToDb() |
---|
362 | { |
---|
363 | if [ $# -ne 3 ]; then |
---|
364 | errorAndLog "${FNCNAME}(): invalid number of parameters" |
---|
365 | exit 1 |
---|
366 | fi |
---|
367 | |
---|
368 | local root_password="$1" |
---|
369 | local database="$2" |
---|
370 | local sqlfile="$3" |
---|
371 | local tmpfile=$(mktemp) |
---|
372 | local i=0 |
---|
373 | local dev="" |
---|
374 | local status |
---|
375 | |
---|
376 | if [ ! -f $sqlfile ]; then |
---|
377 | errorAndLog "${FUNCNAME}(): Unable to locate $sqlfile!!" |
---|
378 | return 1 |
---|
379 | fi |
---|
380 | |
---|
381 | echoAndLog "${FUNCNAME}(): importing SQL file to ${database}..." |
---|
382 | chmod 600 $tmpfile |
---|
383 | for dev in ${DEVICE[*]}; do |
---|
384 | if [ "${SERVERIP[i]} == $DEFAULTDEV" ]; then |
---|
385 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
386 | -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ |
---|
387 | -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ |
---|
388 | $sqlfile > $tmpfile |
---|
389 | fi |
---|
390 | let i++ |
---|
391 | done |
---|
392 | mysql -uroot -p"${root_password}" --default-character-set=utf8 "${database}" < $tmpfile |
---|
393 | status=$? |
---|
394 | rm -f $tmpfile |
---|
395 | if [ $status -ne 0 ]; then |
---|
396 | errorAndLog "${FUNCNAME}(): error while importing $sqlfile in database $database" |
---|
397 | return 1 |
---|
398 | fi |
---|
399 | echoAndLog "${FUNCNAME}(): file imported to database $database" |
---|
400 | return 0 |
---|
401 | } |
---|
402 | |
---|
403 | # Crea la base de datos |
---|
404 | function mysqlCreateDb() |
---|
405 | { |
---|
406 | if [ $# -ne 2 ]; then |
---|
407 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
408 | exit 1 |
---|
409 | fi |
---|
410 | |
---|
411 | local root_password="${1}" |
---|
412 | local database=$2 |
---|
413 | |
---|
414 | echoAndLog "${FUNCNAME}(): creating database..." |
---|
415 | mysqladmin -u root --password="${root_password}" create $database |
---|
416 | if [ $? -ne 0 ]; then |
---|
417 | errorAndLog "${FUNCNAME}(): error while creating database $database" |
---|
418 | return 1 |
---|
419 | fi |
---|
420 | echoAndLog "${FUNCNAME}(): database $database created" |
---|
421 | return 0 |
---|
422 | } |
---|
423 | |
---|
424 | |
---|
425 | function mysqlCheckUserExists() |
---|
426 | { |
---|
427 | if [ $# -ne 2 ]; then |
---|
428 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
429 | exit 1 |
---|
430 | fi |
---|
431 | |
---|
432 | local root_password="${1}" |
---|
433 | local userdb=$2 |
---|
434 | |
---|
435 | echoAndLog "${FUNCNAME}(): checking if $userdb exists..." |
---|
436 | echo "select user from user where user='${userdb}'\\G" |mysql -uroot -p"${root_password}" mysql | grep user |
---|
437 | if [ $? -ne 0 ]; then |
---|
438 | echoAndLog "${FUNCNAME}(): user doesn't exists" |
---|
439 | return 1 |
---|
440 | else |
---|
441 | echoAndLog "${FUNCNAME}(): user already exists" |
---|
442 | return 0 |
---|
443 | fi |
---|
444 | |
---|
445 | } |
---|
446 | |
---|
447 | # Crea un usuario administrativo para la base de datos |
---|
448 | function mysqlCreateAdminUserToDb() |
---|
449 | { |
---|
450 | if [ $# -ne 4 ]; then |
---|
451 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
452 | exit 1 |
---|
453 | fi |
---|
454 | |
---|
455 | local root_password=$1 |
---|
456 | local database=$2 |
---|
457 | local userdb=$3 |
---|
458 | local passdb=$4 |
---|
459 | |
---|
460 | echoAndLog "${FUNCNAME}(): creating admin user ${userdb} to database ${database}" |
---|
461 | |
---|
462 | cat > $WORKDIR/create_${database}.sql <<EOF |
---|
463 | GRANT USAGE ON *.* TO '${userdb}'@'localhost' IDENTIFIED BY '${passdb}' ; |
---|
464 | GRANT ALL PRIVILEGES ON ${database}.* TO '${userdb}'@'localhost' WITH GRANT OPTION ; |
---|
465 | FLUSH PRIVILEGES ; |
---|
466 | EOF |
---|
467 | mysql -u root --password=${root_password} < $WORKDIR/create_${database}.sql |
---|
468 | if [ $? -ne 0 ]; then |
---|
469 | errorAndLog "${FUNCNAME}(): error while creating user in mysql" |
---|
470 | rm -f $WORKDIR/create_${database}.sql |
---|
471 | return 1 |
---|
472 | else |
---|
473 | echoAndLog "${FUNCNAME}(): user created ok" |
---|
474 | rm -f $WORKDIR/create_${database}.sql |
---|
475 | return 0 |
---|
476 | fi |
---|
477 | } |
---|
478 | |
---|
479 | |
---|
480 | ##################################################################### |
---|
481 | ####### Funciones para el manejo de Subversion |
---|
482 | ##################################################################### |
---|
483 | |
---|
484 | function svnExportCode() |
---|
485 | { |
---|
486 | if [ $# -ne 1 ]; then |
---|
487 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
488 | exit 1 |
---|
489 | fi |
---|
490 | |
---|
491 | local url="$1" |
---|
492 | |
---|
493 | echoAndLog "${FUNCNAME}(): downloading subversion code..." |
---|
494 | |
---|
495 | svn export --force "$url" opengnsys |
---|
496 | if [ $? -ne 0 ]; then |
---|
497 | errorAndLog "${FUNCNAME}(): error getting OpenGnSys code from $url" |
---|
498 | return 1 |
---|
499 | fi |
---|
500 | echoAndLog "${FUNCNAME}(): subversion code downloaded" |
---|
501 | return 0 |
---|
502 | } |
---|
503 | |
---|
504 | |
---|
505 | ############################################################ |
---|
506 | ### Detectar red |
---|
507 | ############################################################ |
---|
508 | |
---|
509 | # Comprobar si existe conexión. |
---|
510 | function checkNetworkConnection() |
---|
511 | { |
---|
512 | OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"www.opengnsys.es"} |
---|
513 | wget --spider -q $OPENGNSYS_SERVER |
---|
514 | } |
---|
515 | |
---|
516 | # Obtener los parámetros de red de la interfaz por defecto. |
---|
517 | function getNetworkSettings() |
---|
518 | { |
---|
519 | # Arrays globales definidas: |
---|
520 | # - DEVICE: nombres de dispositivos de red activos. |
---|
521 | # - SERVERIP: IPs locales del servidor. |
---|
522 | # - NETIP: IPs de redes. |
---|
523 | # - NETMASK: máscaras de red. |
---|
524 | # - NETBROAD: IPs de difusión de redes. |
---|
525 | # - ROUTERIP: IPs de routers. |
---|
526 | # Otras variables globales: |
---|
527 | # - DEFAULTDEV: dispositivo de red por defecto. |
---|
528 | # - DNSIP: IP del servidor DNS principal. |
---|
529 | |
---|
530 | local i=0 |
---|
531 | local dev="" |
---|
532 | |
---|
533 | echoAndLog "${FUNCNAME}(): Detecting network parameters." |
---|
534 | DEVICE=( $(ip -o link show up | awk '!/loopback/ {sub(/:.*/,"",$2); print $2}') ) |
---|
535 | if [ -z "$DEVICE" ]; then |
---|
536 | errorAndLog "${FUNCNAME}(): Network devices not detected." |
---|
537 | exit 1 |
---|
538 | fi |
---|
539 | for dev in ${DEVICE[*]}; do |
---|
540 | SERVERIP[i]=$(ip -o addr show dev $dev | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4)}') |
---|
541 | if [ -n "${SERVERIP[i]}" ]; then |
---|
542 | NETMASK[i]=$(LANG=C ifconfig $dev | awk '/Mask/ {sub(/.*:/,"",$4); print $4}') |
---|
543 | NETBROAD[i]=$(ip -o addr show dev $dev | awk '$3~/inet$/ {print ($6)}') |
---|
544 | NETIP[i]=$(netstat -nr | awk -v d="$dev" '$1!~/0\.0\.0\.0/&&$8==d {if (n=="") n=$1} END {print n}') |
---|
545 | ROUTERIP[i]=$(netstat -nr | awk -v d="$dev" '$1~/0\.0\.0\.0/&&$8==d {print $2}') |
---|
546 | DEFAULTDEV=${DEFAULTDEV:-"$dev"} |
---|
547 | let i++ |
---|
548 | fi |
---|
549 | done |
---|
550 | DNSIP=$(awk '/nameserver/ {print $2}' /etc/resolv.conf | head -n1) |
---|
551 | if [ -z "${NETIP}[*]" -o -z "${NETMASK[*]}" ]; then |
---|
552 | errorAndLog "${FUNCNAME}(): Network not detected." |
---|
553 | exit 1 |
---|
554 | fi |
---|
555 | |
---|
556 | # Variables de ejecución de Apache |
---|
557 | # - APACHE_RUN_USER |
---|
558 | # - APACHE_RUN_GROUP |
---|
559 | if [ -f /etc/apache2/envvars ]; then |
---|
560 | source /etc/apache2/envvars |
---|
561 | fi |
---|
562 | APACHE_RUN_USER=${APACHE_RUN_USER:-"www-data"} |
---|
563 | APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-"www-data"} |
---|
564 | } |
---|
565 | |
---|
566 | |
---|
567 | ############################################################ |
---|
568 | ### Esqueleto para el Servicio pxe y contenedor tftpboot ### |
---|
569 | ############################################################ |
---|
570 | |
---|
571 | function tftpConfigure() |
---|
572 | { |
---|
573 | echoAndLog "${FUNCNAME}(): Configuring TFTP service." |
---|
574 | basetftp=/var/lib/tftpboot |
---|
575 | |
---|
576 | # reiniciamos demonio internet ????? porque ???? |
---|
577 | /etc/init.d/openbsd-inetd start |
---|
578 | |
---|
579 | # preparacion contenedor tftpboot |
---|
580 | cp -pr /usr/lib/syslinux/ ${basetftp}/syslinux |
---|
581 | cp /usr/lib/syslinux/pxelinux.0 ${basetftp} |
---|
582 | # prepamos el directorio de la configuracion de pxe |
---|
583 | mkdir -p ${basetftp}/pxelinux.cfg |
---|
584 | cat > ${basetftp}/pxelinux.cfg/default <<EOF |
---|
585 | DEFAULT syslinux/vesamenu.c32 |
---|
586 | MENU TITLE Aplicacion GNSYS |
---|
587 | |
---|
588 | LABEL 1 |
---|
589 | MENU LABEL 1 |
---|
590 | KERNEL syslinux/chain.c32 |
---|
591 | APPEND hd0 |
---|
592 | |
---|
593 | PROMPT 0 |
---|
594 | TIMEOUT 10 |
---|
595 | EOF |
---|
596 | # comprobamos el servicio tftp |
---|
597 | sleep 1 |
---|
598 | testPxe |
---|
599 | ## damos perfimos de lectura a usuario web. |
---|
600 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP ${basetftp} |
---|
601 | } |
---|
602 | |
---|
603 | function testPxe () |
---|
604 | { |
---|
605 | echoAndLog "${FUNCNAME}(): Checking TFTP service... please wait." |
---|
606 | cd /tmp |
---|
607 | tftp -v localhost -c get pxelinux.0 /tmp/pxelinux.0 && echoAndLog "TFTP service is OK." || errorAndLog "TFTP service is down." |
---|
608 | cd / |
---|
609 | } |
---|
610 | |
---|
611 | |
---|
612 | ######################################################################## |
---|
613 | ## Configuracion servicio Samba |
---|
614 | ######################################################################## |
---|
615 | function smbConfigure() |
---|
616 | { |
---|
617 | echoAndLog "${FUNCNAME}(): Configuring Samba service." |
---|
618 | |
---|
619 | backupFile /etc/samba/smb.conf |
---|
620 | |
---|
621 | # Copiar plantailla de recursos para OpenGnSys |
---|
622 | sed -e "s/OPENGNSYSDIR/${INSTALL_TARGET//\//\\/}/g" \ |
---|
623 | $WORKDIR/opengnsys/server/etc/smb-og.conf.tmpl > /etc/samba/smb-og.conf |
---|
624 | # Configurar y recargar Samba" |
---|
625 | perl -pi -e "s/WORKGROUP/OPENGNSYS/; s/server string \=.*/server string \= OpenGnSys Samba Server/; s/^\; *include \=.*$/ include \= \/etc\/samba\/smb-og.conf/" /etc/samba/smb.conf |
---|
626 | /etc/init.d/smbd restart |
---|
627 | if [ $? -ne 0 ]; then |
---|
628 | errorAndLog "${FUNCNAME}(): error while configure Samba" |
---|
629 | return 1 |
---|
630 | fi |
---|
631 | # Crear clave para usuario de acceso a los recursos. |
---|
632 | echo -ne "$OPENGNSYS_CLIENT_PASSWD\n$OPENGNSYS_CLIENT_PASSWD\n" | smbpasswd -a -s $OPENGNSYS_CLIENT_USER |
---|
633 | |
---|
634 | echoAndLog "${FUNCNAME}(): Added Samba configuration." |
---|
635 | return 0 |
---|
636 | } |
---|
637 | |
---|
638 | |
---|
639 | ######################################################################## |
---|
640 | ## Configuracion servicio DHCP |
---|
641 | ######################################################################## |
---|
642 | |
---|
643 | function dhcpConfigure() |
---|
644 | { |
---|
645 | echoAndLog "${FUNCNAME}(): Sample DHCP configuration." |
---|
646 | |
---|
647 | local errcode=0 |
---|
648 | local i=0 |
---|
649 | local dev="" |
---|
650 | |
---|
651 | local DHCPSERVER=/etc/init.d/isc-dhcp-server |
---|
652 | DHCPCFGDIR=/etc/dhcp |
---|
653 | if [ ! -x $DHCPSERVER ]; then |
---|
654 | DHCPSERVER=/etc/init.d/dhcp3-server |
---|
655 | DHCPCFGDIR=/etc/dhcp3 |
---|
656 | fi |
---|
657 | backupFile $DHCPCFGDIR/dhcpd.conf |
---|
658 | for dev in ${DEVICE[*]}; do |
---|
659 | if [ -n "${SERVERIP[$i]}" ]; then |
---|
660 | backupFile $DHCPCFGDIR/dhcpd-$dev.conf |
---|
661 | sed -e "s/SERVERIP/${SERVERIP[$i]}/g" \ |
---|
662 | -e "s/NETIP/${NETIP[$i]}/g" \ |
---|
663 | -e "s/NETMASK/${NETMASK[$i]}/g" \ |
---|
664 | -e "s/NETBROAD/${NETBROAD[$i]}/g" \ |
---|
665 | -e "s/ROUTERIP/${ROUTERIP[$i]}/g" \ |
---|
666 | -e "s/DNSIP/$DNSIP/g" \ |
---|
667 | $WORKDIR/opengnsys/server/etc/dhcpd.conf.tmpl > $DHCPCFGDIR/dhcpd-$dev.conf || errcode=1 |
---|
668 | fi |
---|
669 | let i++ |
---|
670 | done |
---|
671 | if [ $errcode -ne 0 ]; then |
---|
672 | errorAndLog "${FUNCNAME}(): error while configuring DHCP server" |
---|
673 | return 1 |
---|
674 | fi |
---|
675 | ln -f $DHCPCFGDIR/dhcpd-$DEFAULTDEV.conf $DHCPCFGDIR/dhcpd.conf |
---|
676 | $DHCPSERVER restart |
---|
677 | echoAndLog "${FUNCNAME}(): Sample DHCP configured in \"$DHCPCFGDIR\"." |
---|
678 | return 0 |
---|
679 | } |
---|
680 | |
---|
681 | |
---|
682 | ##################################################################### |
---|
683 | ####### Funciones específicas de la instalación de Opengnsys |
---|
684 | ##################################################################### |
---|
685 | |
---|
686 | # Copiar ficheros del OpenGnSys Web Console. |
---|
687 | function installWebFiles() |
---|
688 | { |
---|
689 | echoAndLog "${FUNCNAME}(): Installing web files..." |
---|
690 | cp -ar $WORKDIR/opengnsys/admin/WebConsole/* $INSTALL_TARGET/www #*/ comentario para doxigen |
---|
691 | if [ $? != 0 ]; then |
---|
692 | errorAndLog "${FUNCNAME}(): Error copying web files." |
---|
693 | exit 1 |
---|
694 | fi |
---|
695 | find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null |
---|
696 | # Descomprimir XAJAX. |
---|
697 | unzip $WORKDIR/opengnsys/admin/xajax_0.5_standard.zip -d $INSTALL_TARGET/www/xajax |
---|
698 | # Cambiar permisos para ficheros especiales. |
---|
699 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/images/iconos |
---|
700 | echoAndLog "${FUNCNAME}(): Web files installed successfully." |
---|
701 | } |
---|
702 | |
---|
703 | # Configuración específica de Apache. |
---|
704 | function openGnsysInstallWebConsoleApacheConf() |
---|
705 | { |
---|
706 | if [ $# -ne 2 ]; then |
---|
707 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
708 | exit 1 |
---|
709 | fi |
---|
710 | |
---|
711 | local path_opengnsys_base=$1 |
---|
712 | local path_apache2_confd=$2 |
---|
713 | local path_web_console=${path_opengnsys_base}/www |
---|
714 | |
---|
715 | if [ ! -d $path_apache2_confd ]; then |
---|
716 | errorAndLog "${FUNCNAME}(): path to apache2 conf.d can not found, verify your server installation" |
---|
717 | return 1 |
---|
718 | fi |
---|
719 | |
---|
720 | mkdir -p $path_apache2_confd/{sites-available,sites-enabled} |
---|
721 | |
---|
722 | echoAndLog "${FUNCNAME}(): creating apache2 config file.." |
---|
723 | |
---|
724 | |
---|
725 | # genera configuración |
---|
726 | cat > $path_opengnsys_base/etc/apache.conf <<EOF |
---|
727 | # OpenGnSys Web Console configuration for Apache |
---|
728 | |
---|
729 | Alias /opengnsys ${path_web_console} |
---|
730 | |
---|
731 | <Directory ${path_web_console}> |
---|
732 | Options -Indexes FollowSymLinks |
---|
733 | DirectoryIndex acceso.php |
---|
734 | </Directory> |
---|
735 | EOF |
---|
736 | |
---|
737 | ln -fs $path_opengnsys_base/etc/apache.conf $path_apache2_confd/sites-available/opengnsys.conf |
---|
738 | ln -fs $path_apache2_confd/sites-available/opengnsys.conf $path_apache2_confd/sites-enabled/opengnsys.conf |
---|
739 | if [ $? -ne 0 ]; then |
---|
740 | errorAndLog "${FUNCNAME}(): config file can't be linked to apache conf, verify your server installation" |
---|
741 | return 1 |
---|
742 | else |
---|
743 | echoAndLog "${FUNCNAME}(): config file created and linked, restarting apache daemon" |
---|
744 | /etc/init.d/apache2 restart |
---|
745 | return 0 |
---|
746 | fi |
---|
747 | } |
---|
748 | |
---|
749 | |
---|
750 | # Crear documentación Doxygen para la consola web. |
---|
751 | function makeDoxygenFiles() |
---|
752 | { |
---|
753 | echoAndLog "${FUNCNAME}(): Making Doxygen web files..." |
---|
754 | $WORKDIR/opengnsys/installer/ogGenerateDoc.sh \ |
---|
755 | $WORKDIR/opengnsys/client/engine $INSTALL_TARGET/www |
---|
756 | if [ ! -d "$INSTALL_TARGET/www/html" ]; then |
---|
757 | errorAndLog "${FUNCNAME}(): unable to create Doxygen web files." |
---|
758 | return 1 |
---|
759 | fi |
---|
760 | mv "$INSTALL_TARGET/www/html" "$INSTALL_TARGET/www/api" |
---|
761 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/api |
---|
762 | echoAndLog "${FUNCNAME}(): Doxygen web files created successfully." |
---|
763 | } |
---|
764 | |
---|
765 | |
---|
766 | # Crea la estructura base de la instalación de opengnsys |
---|
767 | function createDirs() |
---|
768 | { |
---|
769 | if [ $# -ne 1 ]; then |
---|
770 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
771 | exit 1 |
---|
772 | fi |
---|
773 | |
---|
774 | local path_opengnsys_base="$1" |
---|
775 | |
---|
776 | # Crear estructura de directorios. |
---|
777 | echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base" |
---|
778 | mkdir -p $path_opengnsys_base |
---|
779 | mkdir -p $path_opengnsys_base/bin |
---|
780 | mkdir -p $path_opengnsys_base/client |
---|
781 | mkdir -p $path_opengnsys_base/doc |
---|
782 | mkdir -p $path_opengnsys_base/etc |
---|
783 | mkdir -p $path_opengnsys_base/lib |
---|
784 | mkdir -p $path_opengnsys_base/log/clients |
---|
785 | ln -fs $path_opengnsys_base/log /var/log/opengnsys |
---|
786 | mkdir -p $path_opengnsys_base/sbin |
---|
787 | mkdir -p $path_opengnsys_base/www |
---|
788 | mkdir -p $path_opengnsys_base/images |
---|
789 | ln -fs /var/lib/tftpboot $path_opengnsys_base |
---|
790 | mkdir -p $path_opengnsys_base/tftpboot/pxelinux.cfg |
---|
791 | if [ $? -ne 0 ]; then |
---|
792 | errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?" |
---|
793 | return 1 |
---|
794 | fi |
---|
795 | |
---|
796 | # Crear usuario ficticio. |
---|
797 | if id -u $OPENGNSYS_CLIENT_USER &>/dev/null; then |
---|
798 | echoAndLog "${FUNCNAME}(): user \"$OPENGNSYS_CLIENT_USER\" is already created" |
---|
799 | else |
---|
800 | echoAndLog "${FUNCNAME}(): creating OpenGnSys user" |
---|
801 | useradd $OPENGNSYS_CLIENT_USER 2>/dev/null |
---|
802 | if [ $? -ne 0 ]; then |
---|
803 | errorAndLog "${FUNCNAME}(): error creating OpenGnSys user" |
---|
804 | return 1 |
---|
805 | fi |
---|
806 | fi |
---|
807 | |
---|
808 | # Establecer los permisos básicos. |
---|
809 | echoAndLog "${FUNCNAME}(): setting directory permissions" |
---|
810 | chmod -R 775 $path_opengnsys_base/{log/clients,images,tftpboot/pxelinux.cfg} |
---|
811 | chown -R :$OPENGNSYS_CLIENT_USER $path_opengnsys_base/{log/clients,images,tftpboot/pxelinux.cfg} |
---|
812 | if [ $? -ne 0 ]; then |
---|
813 | errorAndLog "${FUNCNAME}(): error while setting permissions" |
---|
814 | return 1 |
---|
815 | fi |
---|
816 | |
---|
817 | echoAndLog "${FUNCNAME}(): directory paths created" |
---|
818 | return 0 |
---|
819 | } |
---|
820 | |
---|
821 | # Copia ficheros de configuración y ejecutables genéricos del servidor. |
---|
822 | function openGnsysCopyServerFiles () |
---|
823 | { |
---|
824 | if [ $# -ne 1 ]; then |
---|
825 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
826 | exit 1 |
---|
827 | fi |
---|
828 | |
---|
829 | local path_opengnsys_base="$1" |
---|
830 | |
---|
831 | local SOURCES=( server/tftpboot/pxelinux.cfg \ |
---|
832 | server/bin \ |
---|
833 | repoman/bin \ |
---|
834 | installer/opengnsys_uninstall.sh \ |
---|
835 | installer/opengnsys_update.sh \ |
---|
836 | doc ) |
---|
837 | local TARGETS=( tftpboot/pxelinux.cfg \ |
---|
838 | bin \ |
---|
839 | bin \ |
---|
840 | lib \ |
---|
841 | lib \ |
---|
842 | doc ) |
---|
843 | |
---|
844 | if [ ${#SOURCES[@]} != ${#TARGETS[@]} ]; then |
---|
845 | errorAndLog "${FUNCNAME}(): inconsistent number of array items" |
---|
846 | exit 1 |
---|
847 | fi |
---|
848 | |
---|
849 | echoAndLog "${FUNCNAME}(): copying files to server directories" |
---|
850 | |
---|
851 | pushd $WORKDIR/opengnsys |
---|
852 | local i |
---|
853 | for (( i = 0; i < ${#SOURCES[@]}; i++ )); do |
---|
854 | if [ -f "${SOURCES[$i]}" ]; then |
---|
855 | echoAndLog "Copying ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}" |
---|
856 | cp -a "${SOURCES[$i]}" "${path_opengnsys_base}/${TARGETS[$i]}" |
---|
857 | elif [ -d "${SOURCES[$i]}" ]; then |
---|
858 | echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}" |
---|
859 | cp -a "${SOURCES[$i]}"/* "${path_opengnsys_base}/${TARGETS[$i]}" |
---|
860 | else |
---|
861 | echoAndLog "Warning: Unable to copy ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}" |
---|
862 | fi |
---|
863 | done |
---|
864 | popd |
---|
865 | } |
---|
866 | |
---|
867 | #################################################################### |
---|
868 | ### Funciones de compilación de códifo fuente de servicios |
---|
869 | #################################################################### |
---|
870 | |
---|
871 | # Compilar los servicios de OpenGNsys |
---|
872 | function servicesCompilation () |
---|
873 | { |
---|
874 | local hayErrores=0 |
---|
875 | |
---|
876 | # Compilar OpenGnSys Server |
---|
877 | echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Admin Server" |
---|
878 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer |
---|
879 | make && mv ogAdmServer $INSTALL_TARGET/sbin |
---|
880 | if [ $? -ne 0 ]; then |
---|
881 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Admin Server" |
---|
882 | hayErrores=1 |
---|
883 | fi |
---|
884 | popd |
---|
885 | # Compilar OpenGnSys Repository Manager |
---|
886 | echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Repository Manager" |
---|
887 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmRepo |
---|
888 | make && mv ogAdmRepo $INSTALL_TARGET/sbin |
---|
889 | if [ $? -ne 0 ]; then |
---|
890 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Repository Manager" |
---|
891 | hayErrores=1 |
---|
892 | fi |
---|
893 | popd |
---|
894 | # Compilar OpenGnSys Agent |
---|
895 | echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Agent" |
---|
896 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent |
---|
897 | make && mv ogAdmAgent $INSTALL_TARGET/sbin |
---|
898 | if [ $? -ne 0 ]; then |
---|
899 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Agent" |
---|
900 | hayErrores=1 |
---|
901 | fi |
---|
902 | popd |
---|
903 | # Compilar OpenGnSys Client |
---|
904 | echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Admin Client" |
---|
905 | pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient |
---|
906 | make && mv ogAdmClient ../../../../client/shared/bin |
---|
907 | if [ $? -ne 0 ]; then |
---|
908 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Admin Client" |
---|
909 | hayErrores=1 |
---|
910 | fi |
---|
911 | popd |
---|
912 | |
---|
913 | return $hayErrores |
---|
914 | } |
---|
915 | |
---|
916 | #################################################################### |
---|
917 | ### Funciones de copia de la Interface de administración |
---|
918 | #################################################################### |
---|
919 | |
---|
920 | # Copiar carpeta de Interface |
---|
921 | function copyInterfaceAdm () |
---|
922 | { |
---|
923 | local hayErrores=0 |
---|
924 | |
---|
925 | # Crear carpeta y copiar Interface |
---|
926 | echoAndLog "${FUNCNAME}(): Copying Administration Interface Folder" |
---|
927 | cp -ar $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client/interfaceAdm |
---|
928 | if [ $? -ne 0 ]; then |
---|
929 | echoAndLog "${FUNCNAME}(): error while copying Administration Interface Folder" |
---|
930 | hayErrores=1 |
---|
931 | fi |
---|
932 | chown $OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso |
---|
933 | chmod 700 $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso |
---|
934 | |
---|
935 | return $hayErrores |
---|
936 | } |
---|
937 | |
---|
938 | #################################################################### |
---|
939 | ### Funciones instalacion cliente opengnsys |
---|
940 | #################################################################### |
---|
941 | |
---|
942 | function openGnsysCopyClientFiles() |
---|
943 | { |
---|
944 | local hayErrores=0 |
---|
945 | |
---|
946 | echoAndLog "${FUNCNAME}(): Copying OpenGnSys Client files." |
---|
947 | cp -ar $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client |
---|
948 | if [ $? -ne 0 ]; then |
---|
949 | errorAndLog "${FUNCNAME}(): error while copying client estructure" |
---|
950 | hayErrores=1 |
---|
951 | fi |
---|
952 | find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null |
---|
953 | |
---|
954 | echoAndLog "${FUNCNAME}(): Copying OpenGnSys Cloning Engine files." |
---|
955 | mkdir -p $INSTALL_TARGET/client/lib/engine/bin |
---|
956 | cp -ar $WORKDIR/opengnsys/client/engine/*.lib $INSTALL_TARGET/client/lib/engine/bin |
---|
957 | if [ $? -ne 0 ]; then |
---|
958 | errorAndLog "${FUNCNAME}(): error while copying engine files" |
---|
959 | hayErrores=1 |
---|
960 | fi |
---|
961 | |
---|
962 | if [ $hayErrores -eq 0 ]; then |
---|
963 | echoAndLog "${FUNCNAME}(): client copy files success." |
---|
964 | else |
---|
965 | errorAndLog "${FUNCNAME}(): client copy files with errors" |
---|
966 | fi |
---|
967 | |
---|
968 | return $hayErrores |
---|
969 | } |
---|
970 | |
---|
971 | |
---|
972 | |
---|
973 | |
---|
974 | # Crear antiguo cliente initrd para OpenGnSys 0.10 |
---|
975 | function openGnsysOldClientCreate() |
---|
976 | { |
---|
977 | local OSCODENAME |
---|
978 | |
---|
979 | local hayErrores=0 |
---|
980 | |
---|
981 | # Cargar Kernel, Initrd y paquetes udeb para la distribución del servidor (o por defecto). |
---|
982 | OSCODENAME=$(lsb_release -cs 2>/dev/null) |
---|
983 | if [ "$OSDISTRIB" = "Ubuntu" -a -n "$OSCODENAME" ]; then |
---|
984 | echoAndLog "${FUNCNAME}(): Loading Kernel and Initrd files for $OSDISTRIB $OSCODENAME." |
---|
985 | $INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot -v $OSCODENAME 2>&1 | tee -a $LOG_FILE |
---|
986 | if [ $? -ne 0 ]; then |
---|
987 | errorAndLog "${FUNCNAME}(): error while generating initrd OpenGnSys Admin Client" |
---|
988 | hayErrores=1 |
---|
989 | fi |
---|
990 | echoAndLog "${FUNCNAME}(): Loading udeb files for $OSDISTRIB $OSCODENAME." |
---|
991 | $INSTALL_TARGET/bin/upgrade-clients-udeb.sh $OSCODENAME 2>&1 | tee -a $LOG_FILE |
---|
992 | if [ $? -ne 0 ]; then |
---|
993 | errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGnSys Admin Client" |
---|
994 | hayErrores=1 |
---|
995 | fi |
---|
996 | else |
---|
997 | echoAndLog "${FUNCNAME}(): Loading default Kernel and Initrd files." |
---|
998 | $INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot 2>&1 | tee -a $LOG_FILE |
---|
999 | if [ $? -ne 0 ]; then |
---|
1000 | errorAndLog "${FUNCNAME}(): error while generating initrd OpenGnSys Admin Client" |
---|
1001 | hayErrores=1 |
---|
1002 | fi |
---|
1003 | echoAndLog "${FUNCNAME}(): Loading default udeb files." |
---|
1004 | $INSTALL_TARGET/bin/upgrade-clients-udeb.sh 2>&1 | tee -a $LOG_FILE |
---|
1005 | if [ $? -ne 0 ]; then |
---|
1006 | errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGnSys Admin Client" |
---|
1007 | hayErrores=1 |
---|
1008 | fi |
---|
1009 | fi |
---|
1010 | |
---|
1011 | if [ $hayErrores -eq 0 ]; then |
---|
1012 | echoAndLog "${FUNCNAME}(): Old client generation success." |
---|
1013 | else |
---|
1014 | errorAndLog "${FUNCNAME}(): Old client generation with errors" |
---|
1015 | fi |
---|
1016 | |
---|
1017 | return $hayErrores |
---|
1018 | } |
---|
1019 | |
---|
1020 | |
---|
1021 | # Crear nuevo cliente OpenGnSys 1.0 |
---|
1022 | function openGnsysClientCreate() |
---|
1023 | { |
---|
1024 | local DOWNLOADURL=http://www.opengnsys.es/downloads |
---|
1025 | local FILENAME=ogclient-1.0.1-lucid-32bit.tar.gz |
---|
1026 | local TMPFILE=/tmp/$FILENAME |
---|
1027 | |
---|
1028 | echoAndLog "${FUNCNAME}(): Loading Client" |
---|
1029 | # Descargar y descomprimir cliente ogclient |
---|
1030 | wget $DOWNLOADURL/$FILENAME -O $TMPFILE |
---|
1031 | if [ ! -s $TMPFILE ]; then |
---|
1032 | errorAndLog "${FUNCNAME}(): Error loading OpenGnSys Client" |
---|
1033 | return 1 |
---|
1034 | fi |
---|
1035 | echoAndLog "${FUNCNAME}(): Extranting Client files" |
---|
1036 | tar xzvf $TMPFILE -C $INSTALL_TARGET/tftpboot |
---|
1037 | rm -f $TMPFILE |
---|
1038 | # Usar la versión más reciente del Kernel y del Initrd para el cliente. |
---|
1039 | ln -f $(ls $INSTALL_TARGET/tftpboot/ogclient/vmlinuz-*|tail -1) $INSTALL_TARGET/tftpboot/ogclient/ogvmlinuz |
---|
1040 | ln -f $(ls $INSTALL_TARGET/tftpboot/ogclient/initrd.img-*|tail -1) $INSTALL_TARGET/tftpboot/ogclient/oginitrd.img |
---|
1041 | # Establecer los permisos. |
---|
1042 | chmod -R 755 $INSTALL_TARGET/tftpboot/ogclient |
---|
1043 | chown -R :$OPENGNSYS_CLIENT_USER $INSTALL_TARGET/tftpboot/ogclient |
---|
1044 | echoAndLog "${FUNCNAME}(): Client generation success" |
---|
1045 | } |
---|
1046 | |
---|
1047 | |
---|
1048 | # Configuración básica de servicios de OpenGnSys |
---|
1049 | function openGnsysConfigure() |
---|
1050 | { |
---|
1051 | local i=0 |
---|
1052 | local dev="" |
---|
1053 | |
---|
1054 | echoAndLog "${FUNCNAME}(): Copying init files." |
---|
1055 | cp -p $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys |
---|
1056 | cp -p $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys |
---|
1057 | cp -p $WORKDIR/opengnsys/admin/Sources/Services/ogAdmRepoAux /opt/opengnsys/sbin/ |
---|
1058 | update-rc.d opengnsys defaults |
---|
1059 | echoAndLog "${FUNCNAME}(): Creating cron files." |
---|
1060 | echo "* * * * * root [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator |
---|
1061 | echo "5 * * * * root [ -x $INSTALL_TARGET/bin/torrent-tracker ] && $INSTALL_TARGET/bin/torrent-tracker" > /etc/cron.d/torrenttracker |
---|
1062 | |
---|
1063 | echoAndLog "${FUNCNAME}(): Creating OpenGnSys config files." |
---|
1064 | for dev in ${DEVICE[*]}; do |
---|
1065 | if [ -n "${SERVERIP[i]}" ]; then |
---|
1066 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
1067 | -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ |
---|
1068 | -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ |
---|
1069 | -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ |
---|
1070 | $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer/ogAdmServer.cfg > $INSTALL_TARGET/etc/ogAdmServer-$dev.cfg |
---|
1071 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
1072 | $WORKDIR/opengnsys/admin/Sources/Services/ogAdmRepo/ogAdmRepo.cfg > $INSTALL_TARGET/etc/ogAdmRepo-$dev.cfg |
---|
1073 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
1074 | -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ |
---|
1075 | -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ |
---|
1076 | -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ |
---|
1077 | $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent/ogAdmAgent.cfg > $INSTALL_TARGET/etc/ogAdmAgent-$dev.cfg |
---|
1078 | OPENGNSYS_CONSOLEURL="http://${SERVERIP[i]}/opengnsys" |
---|
1079 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
1080 | -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ |
---|
1081 | -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \ |
---|
1082 | -e "s/DATABASE/$OPENGNSYS_DATABASE/g" \ |
---|
1083 | -e "s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" \ |
---|
1084 | $INSTALL_TARGET/www/controlacceso.php > $INSTALL_TARGET/www/controlacceso-$dev.php |
---|
1085 | sed -e "s/SERVERIP/${SERVERIP[i]}/g" \ |
---|
1086 | -e "s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" \ |
---|
1087 | $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient-$dev.cfg |
---|
1088 | fi |
---|
1089 | let i++ |
---|
1090 | done |
---|
1091 | ln -f $INSTALL_TARGET/etc/ogAdmServer-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmServer.cfg |
---|
1092 | ln -f $INSTALL_TARGET/etc/ogAdmRepo-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmRepo.cfg |
---|
1093 | ln -f $INSTALL_TARGET/etc/ogAdmAgent-$DEFAULTDEV.cfg $INSTALL_TARGET/etc/ogAdmAgent.cfg |
---|
1094 | ln -f $INSTALL_TARGET/client/etc/ogAdmClient-$DEFAULTDEV.cfg $INSTALL_TARGET/client/etc/ogAdmClient.cfg |
---|
1095 | ln -f $INSTALL_TARGET/www/controlacceso-$DEFAULTDEV.php $INSTALL_TARGET/www/controlacceso.php |
---|
1096 | chown root:root $INSTALL_TARGET/etc/{ogAdmServer,ogAdmAgent}*.cfg |
---|
1097 | chmod 600 $INSTALL_TARGET/etc/{ogAdmServer,ogAdmAgent}*.cfg |
---|
1098 | chown $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/controlacceso*.php |
---|
1099 | chmod 600 $INSTALL_TARGET/www/controlacceso*.php |
---|
1100 | echoAndLog "${FUNCNAME}(): Starting OpenGnSys services." |
---|
1101 | /etc/init.d/opengnsys start |
---|
1102 | } |
---|
1103 | |
---|
1104 | |
---|
1105 | ##################################################################### |
---|
1106 | ####### Función de resumen informativo de la instalación |
---|
1107 | ##################################################################### |
---|
1108 | |
---|
1109 | function installationSummary() |
---|
1110 | { |
---|
1111 | # Crear fichero de versión y revisión, si no existe. |
---|
1112 | local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" |
---|
1113 | local REVISION=$(LANG=C svn info $SVN_URL|awk '/Revision:/ {print "r"$2}') |
---|
1114 | [ -f $VERSIONFILE ] || echo "OpenGnSys" >$VERSIONFILE |
---|
1115 | perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE |
---|
1116 | |
---|
1117 | # Mostrar información. |
---|
1118 | echo |
---|
1119 | echoAndLog "OpenGnSys Installation Summary" |
---|
1120 | echo "==============================" |
---|
1121 | echoAndLog "Project version: $(cat $VERSIONFILE 2>/dev/null)" |
---|
1122 | echoAndLog "Installation directory: $INSTALL_TARGET" |
---|
1123 | echoAndLog "Repository directory: $INSTALL_TARGET/images" |
---|
1124 | echoAndLog "DHCP configuration directory: $DHCPCFGDIR" |
---|
1125 | echoAndLog "TFTP configuration directory: /var/lib/tftpboot" |
---|
1126 | echoAndLog "Samba configuration directory: /etc/samba" |
---|
1127 | echoAndLog "Web Console URL: $OPENGNSYS_CONSOLEURL" |
---|
1128 | echoAndLog "Web Console admin user: $OPENGNSYS_DB_USER" |
---|
1129 | echoAndLog "Web Console admin password: $OPENGNSYS_DB_PASSWD" |
---|
1130 | echo |
---|
1131 | echoAndLog "Post-Installation Instructions:" |
---|
1132 | echo "===============================" |
---|
1133 | echoAndLog "Review or edit all configuration files." |
---|
1134 | echoAndLog "Insert DHCP configuration data and restart service." |
---|
1135 | echoAndLog "Log-in as Web Console admin user." |
---|
1136 | echoAndLog " - Review default Organization data and assign default user." |
---|
1137 | echoAndLog "Log-in as Web Console organization user." |
---|
1138 | echoAndLog " - Insert OpenGnSys data (rooms, computers, menus, etc)." |
---|
1139 | echo |
---|
1140 | } |
---|
1141 | |
---|
1142 | |
---|
1143 | |
---|
1144 | ##################################################################### |
---|
1145 | ####### Proceso de instalación de OpenGnSys |
---|
1146 | ##################################################################### |
---|
1147 | |
---|
1148 | echoAndLog "OpenGnSys installation begins at $(date)" |
---|
1149 | pushd $WORKDIR |
---|
1150 | |
---|
1151 | # Detectar parámetros de red y comprobar si hay conexión. |
---|
1152 | getNetworkSettings |
---|
1153 | if [ $? -ne 0 ]; then |
---|
1154 | errorAndLog "Error reading default network settings." |
---|
1155 | exit 1 |
---|
1156 | fi |
---|
1157 | checkNetworkConnection |
---|
1158 | if [ $? -ne 0 ]; then |
---|
1159 | errorAndLog "Error connecting to server. Causes:" |
---|
1160 | errorAndLog " - Network is unreachable, review devices parameters." |
---|
1161 | errorAndLog " - You are inside a private network, configure the proxy service." |
---|
1162 | errorAndLog " - Server is temporally down, try agian later." |
---|
1163 | exit 1 |
---|
1164 | fi |
---|
1165 | |
---|
1166 | # Detener servicios de OpenGnSys, si están activos previamente. |
---|
1167 | [ -f /etc/init.d/opengnsys ] && /etc/init.d/opengnsys stop |
---|
1168 | |
---|
1169 | # Actualizar repositorios |
---|
1170 | apt-get update |
---|
1171 | |
---|
1172 | # Instalación de dependencias (paquetes de sistema operativo). |
---|
1173 | declare -a notinstalled |
---|
1174 | checkDependencies DEPENDENCIES notinstalled |
---|
1175 | if [ $? -ne 0 ]; then |
---|
1176 | installDependencies notinstalled |
---|
1177 | if [ $? -ne 0 ]; then |
---|
1178 | echoAndLog "Error while installing some dependeces, please verify your server installation before continue" |
---|
1179 | exit 1 |
---|
1180 | fi |
---|
1181 | fi |
---|
1182 | |
---|
1183 | # Arbol de directorios de OpenGnSys. |
---|
1184 | createDirs ${INSTALL_TARGET} |
---|
1185 | if [ $? -ne 0 ]; then |
---|
1186 | errorAndLog "Error while creating directory paths!" |
---|
1187 | exit 1 |
---|
1188 | fi |
---|
1189 | |
---|
1190 | # Si es necesario, descarga el repositorio de código en directorio temporal |
---|
1191 | if [ $USESVN -eq 1 ]; then |
---|
1192 | svnExportCode $SVN_URL |
---|
1193 | if [ $? -ne 0 ]; then |
---|
1194 | errorAndLog "Error while getting code from svn" |
---|
1195 | exit 1 |
---|
1196 | fi |
---|
1197 | else |
---|
1198 | ln -fs "$(dirname $PROGRAMDIR)" opengnsys |
---|
1199 | fi |
---|
1200 | |
---|
1201 | # Compilar código fuente de los servicios de OpenGnSys. |
---|
1202 | servicesCompilation |
---|
1203 | if [ $? -ne 0 ]; then |
---|
1204 | errorAndLog "Error while compiling OpenGnsys services" |
---|
1205 | exit 1 |
---|
1206 | fi |
---|
1207 | |
---|
1208 | # Copiar carpeta Interface entre administración y motor de clonación. |
---|
1209 | copyInterfaceAdm |
---|
1210 | if [ $? -ne 0 ]; then |
---|
1211 | errorAndLog "Error while copying Administration Interface" |
---|
1212 | exit 1 |
---|
1213 | fi |
---|
1214 | |
---|
1215 | # Configurando tftp |
---|
1216 | tftpConfigure |
---|
1217 | |
---|
1218 | # Configuración NFS |
---|
1219 | #### (descomentar las siguientes líneas para exportar servicios por NFS) |
---|
1220 | #nfsConfigure |
---|
1221 | #if [ $? -ne 0 ]; then |
---|
1222 | # errorAndLog "Error while configuring nfs server!" |
---|
1223 | # exit 1 |
---|
1224 | #fi |
---|
1225 | |
---|
1226 | # Configuración Samba |
---|
1227 | smbConfigure |
---|
1228 | if [ $? -ne 0 ]; then |
---|
1229 | errorAndLog "Error while configuring Samba server!" |
---|
1230 | exit 1 |
---|
1231 | fi |
---|
1232 | |
---|
1233 | # Configuración ejemplo DHCP |
---|
1234 | dhcpConfigure |
---|
1235 | if [ $? -ne 0 ]; then |
---|
1236 | errorAndLog "Error while copying your dhcp server files!" |
---|
1237 | exit 1 |
---|
1238 | fi |
---|
1239 | |
---|
1240 | # Copiar ficheros de servicios OpenGnSys Server. |
---|
1241 | openGnsysCopyServerFiles ${INSTALL_TARGET} |
---|
1242 | if [ $? -ne 0 ]; then |
---|
1243 | errorAndLog "Error while copying the server files!" |
---|
1244 | exit 1 |
---|
1245 | fi |
---|
1246 | |
---|
1247 | # Instalar Base de datos de OpenGnSys Admin. |
---|
1248 | isInArray notinstalled "mysql-server" |
---|
1249 | if [ $? -eq 0 ]; then |
---|
1250 | mysqlSetRootPassword ${MYSQL_ROOT_PASSWORD} |
---|
1251 | else |
---|
1252 | mysqlGetRootPassword |
---|
1253 | fi |
---|
1254 | |
---|
1255 | mysqlTestConnection ${MYSQL_ROOT_PASSWORD} |
---|
1256 | if [ $? -ne 0 ]; then |
---|
1257 | errorAndLog "Error while connection to mysql" |
---|
1258 | exit 1 |
---|
1259 | fi |
---|
1260 | mysqlDbExists ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} |
---|
1261 | if [ $? -ne 0 ]; then |
---|
1262 | echoAndLog "Creating Web Console database" |
---|
1263 | mysqlCreateDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} |
---|
1264 | if [ $? -ne 0 ]; then |
---|
1265 | errorAndLog "Error while creating Web Console database" |
---|
1266 | exit 1 |
---|
1267 | fi |
---|
1268 | else |
---|
1269 | echoAndLog "Web Console database exists, ommiting creation" |
---|
1270 | fi |
---|
1271 | |
---|
1272 | mysqlCheckUserExists ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DB_USER} |
---|
1273 | if [ $? -ne 0 ]; then |
---|
1274 | echoAndLog "Creating user in database" |
---|
1275 | mysqlCreateAdminUserToDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} ${OPENGNSYS_DB_USER} "${OPENGNSYS_DB_PASSWD}" |
---|
1276 | if [ $? -ne 0 ]; then |
---|
1277 | errorAndLog "Error while creating database user" |
---|
1278 | exit 1 |
---|
1279 | fi |
---|
1280 | |
---|
1281 | fi |
---|
1282 | |
---|
1283 | mysqlCheckDbIsEmpty ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} |
---|
1284 | if [ $? -eq 0 ]; then |
---|
1285 | echoAndLog "Creating tables..." |
---|
1286 | if [ -f $WORKDIR/$OPENGNSYS_DB_CREATION_FILE ]; then |
---|
1287 | mysqlImportSqlFileToDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} $WORKDIR/$OPENGNSYS_DB_CREATION_FILE |
---|
1288 | else |
---|
1289 | errorAndLog "Unable to locate $WORKDIR/$OPENGNSYS_DB_CREATION_FILE!!" |
---|
1290 | exit 1 |
---|
1291 | fi |
---|
1292 | else |
---|
1293 | # Si existe fichero ogBDAdmin-VersLocal-VersRepo.sql; aplicar cambios. |
---|
1294 | INSTVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt) |
---|
1295 | REPOVERSION=$(awk '{print $2}' $WORKDIR/opengnsys/doc/VERSION.txt) |
---|
1296 | OPENGNSYS_DB_UPDATE_FILE="opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-$REPOVERSION.sql" |
---|
1297 | if [ -f $WORKDIR/$OPENGNSYS_DB_UPDATE_FILE ]; then |
---|
1298 | echoAndLog "Updating tables from version $INSTVERSION to $REPOVERSION" |
---|
1299 | mysqlImportSqlFileToDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} $WORKDIR/$OPENGNSYS_DB_UPDATE_FILE |
---|
1300 | else |
---|
1301 | echoAndLog "Database unchanged." |
---|
1302 | fi |
---|
1303 | fi |
---|
1304 | |
---|
1305 | # copiando paqinas web |
---|
1306 | installWebFiles |
---|
1307 | # Generar páqinas web de documentación de la API |
---|
1308 | makeDoxygenFiles |
---|
1309 | |
---|
1310 | # creando configuracion de apache2 |
---|
1311 | openGnsysInstallWebConsoleApacheConf $INSTALL_TARGET /etc/apache2 |
---|
1312 | if [ $? -ne 0 ]; then |
---|
1313 | errorAndLog "Error configuring Apache for OpenGnSYS Admin" |
---|
1314 | exit 1 |
---|
1315 | fi |
---|
1316 | |
---|
1317 | popd |
---|
1318 | |
---|
1319 | |
---|
1320 | # Crear la estructura de los accesos al servidor desde el cliente (shared) |
---|
1321 | openGnsysCopyClientFiles |
---|
1322 | if [ $? -ne 0 ]; then |
---|
1323 | errorAndLog "Error creating client structure" |
---|
1324 | fi |
---|
1325 | |
---|
1326 | # Crear la estructura del antiguo cliente initrd de OpenGnSys 0.10 |
---|
1327 | #### (descomentar las siguientes líneas para generar cliente initrd) |
---|
1328 | #openGnsysOldClientCreate |
---|
1329 | #if [ $? -ne 0 ]; then |
---|
1330 | # errorAndLog "Warning: cannot create old initrd client" |
---|
1331 | #fi |
---|
1332 | |
---|
1333 | # Crear la estructura del cliente de OpenGnSys 1.0 |
---|
1334 | openGnsysClientCreate |
---|
1335 | if [ $? -ne 0 ]; then |
---|
1336 | errorAndLog "Error creating client" |
---|
1337 | exit 1 |
---|
1338 | fi |
---|
1339 | |
---|
1340 | # Configuración de servicios de OpenGnSys |
---|
1341 | openGnsysConfigure |
---|
1342 | |
---|
1343 | # Mostrar sumario de la instalación e instrucciones de post-instalación. |
---|
1344 | installationSummary |
---|
1345 | |
---|
1346 | #rm -rf $WORKDIR |
---|
1347 | echoAndLog "OpenGnSys installation finished at $(date)" |
---|
1348 | |
---|