source: installer/opengnsys_installer.sh @ 1c9cd8b1

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 1c9cd8b1 was 1e7eaab, checked in by ramon <ramongomez@…>, 15 years ago

Installador vale para repositorio y descargable; funciones de API compatibles Doxygen.

git-svn-id: https://opengnsys.es/svn/trunk@652 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 33.2 KB
RevLine 
[a01156a]1#!/bin/bash
2
3#####################################################################
4####### Script instalador OpenGnsys
5####### autor: Luis Guillén <lguillen@unizar.es>
6#####################################################################
7
8
[1e7eaab]9
10# Sólo ejecutable por usuario root
11if [ "$(whoami)" != 'root' ]
12then
13        echo "ERROR: this program must run under root privileges!!"
14        exit 1
15fi
16
17# Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1).
18pushd $(dirname $0) >/dev/null
19PROGRAMDIR=$PWD
20popd >/dev/null
21if [ -d "$PROGRAMDIR/../installer" ]; then
22    USESVN=0
23else
24    USESVN=1
25    SVN_URL=svn://www.informatica.us.es:3690/opengnsys/trunk
26fi
27
[a01156a]28WORKDIR=/tmp/opengnsys_installer
[1e7eaab]29mkdir -p $WORKDIR
30pushd $WORKDIR
31
32INSTALL_TARGET=/opt/opengnsys
[13a01a7]33LOG_FILE=/tmp/opengnsys_installation.log
[a01156a]34
35# Array con las dependencias
[0795938]36DEPENDENCIES=( subversion apache2 php5 mysql-server php5-mysql nfs-kernel-server dhcp3-server udpcast bittorrent tftp-hpa tftpd-hpa syslinux openbsd-inetd update-inetd build-essential libmysqlclient15-dev wget doxygen graphviz)
[a01156a]37
[892606b9]38MYSQL_ROOT_PASSWORD="passwordroot"
39
[a01156a]40# Datos de base de datos
[892606b9]41OPENGNSYS_DATABASE=ogBDAdmin
42OPENGNSYS_DB_USER=usuog
43OPENGNSYS_DB_PASSWD=passusuog
[be85bb2]44OPENGNSYS_DB_DEFAULTUSER=opengnsys
45OPENGNSYS_DB_DEFAULTPASSWD=opengnsys
[892606b9]46OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/ogBDAdmin.sql
47
[a01156a]48
49
50#####################################################################
51####### Algunas funciones útiles de propósito general:
52#####################################################################
[13a01a7]53function getDateTime()
[a01156a]54{
55        echo `date +%Y%m%d-%H%M%S`
56}
57
58# Escribe a fichero y muestra por pantalla
[13a01a7]59function echoAndLog()
[a01156a]60{
61        echo $1
62        FECHAHORA=`getDateTime`
63        echo "$FECHAHORA;$SSH_CLIENT;$1" >> $LOG_FILE
64}
65
[13a01a7]66function errorAndLog()
[a01156a]67{
68        echo "ERROR: $1"
69        FECHAHORA=`getDateTime`
70        echo "$FECHAHORA;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE
71}
72
73# comprueba si el elemento pasado en $2 esta en el array $1
[13a01a7]74function isInArray()
[a01156a]75{
76        if [ $# -ne 2 ]; then
[13a01a7]77                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[a01156a]78                exit 1
79        fi
80
[13a01a7]81        echoAndLog "${FUNCNAME}(): checking if $2 is in $1"
[a01156a]82        local deps
[5c33840]83        eval "deps=( \"\${$1[@]}\" )"
[a01156a]84        elemento=$2
85
86        local is_in_array=1
87        # copia local del array del parametro 1
88        for (( i = 0 ; i < ${#deps[@]} ; i++ ))
89        do
90                if [ "${deps[$i]}" = "${elemento}" ]; then
91                        echoAndLog "isInArray(): $elemento found in array"
92                        is_in_array=0
93                fi
94        done
95
96        if [ $is_in_array -ne 0 ]; then
[13a01a7]97                echoAndLog "${FUNCNAME}(): $elemento NOT found in array"
[a01156a]98        fi
99
100        return $is_in_array
101
102}
103
104#####################################################################
105####### Funciones de manejo de paquetes Debian
106#####################################################################
107
[13a01a7]108function checkPackage()
[a01156a]109{
110        package=$1
111        if [ -z $package ]; then
112                errorAndLog "checkPackage(): parameter required"
113                exit 1
114        fi
115        echoAndLog "checkPackage(): checking if package $package exists"
116        dpkg -L $package &>/dev/null
117        if [ $? -eq 0 ]; then
118                echoAndLog "checkPackage(): package $package exists"
119                return 0
120        else
121                echoAndLog "checkPackage(): package $package doesn't exists"
122                return 1
123        fi
124}
125
126# recibe array con dependencias
127# por referencia deja un array con las dependencias no resueltas
128# devuelve 1 si hay alguna dependencia no resuelta
[13a01a7]129function checkDependencies()
[a01156a]130{
131        if [ $# -ne 2 ]; then
132                errorAndLog "checkDependencies(): invalid number of parameters"
133                exit 1
134        fi
135
136        echoAndLog "checkDependencies(): checking dependences"
137        uncompletedeps=0
138
139        # copia local del array del parametro 1
140        local deps
[5c33840]141        eval "deps=( \"\${$1[@]}\" )"
[a01156a]142
143        declare -a local_notinstalled
[5c33840]144
[a01156a]145        for (( i = 0 ; i < ${#deps[@]} ; i++ ))
146        do
147                checkPackage ${deps[$i]}
148                if [ $? -ne 0 ]; then
149                        local_notinstalled[$uncompletedeps]=$package
150                        let uncompletedeps=uncompletedeps+1
151                fi
152        done
153
154        # relleno el array especificado en $2 por referencia
155        for (( i = 0 ; i < ${#local_notinstalled[@]} ; i++ ))
156        do
157                eval "${2}[$i]=${local_notinstalled[$i]}"
158        done
159
160        # retorna el numero de paquetes no resueltos
161        echoAndLog "checkDependencies(): dependencies uncompleted: $uncompletedeps"
162        return $uncompletedeps
163}
164
165# Recibe un array con las dependencias y lo instala
[13a01a7]166function installDependencies()
[a01156a]167{
168        if [ $# -ne 1 ]; then
169                errorAndLog "installDependencies(): invalid number of parameters"
170                exit 1
171        fi
172        echoAndLog "installDependencies(): installing uncompleted dependencies"
173
174        # copia local del array del parametro 1
175        local deps
[5c33840]176        eval "deps=( \"\${$1[@]}\" )"
[a01156a]177
178        local string_deps=""
179        for (( i = 0 ; i < ${#deps[@]} ; i++ ))
180        do
181                string_deps="$string_deps ${deps[$i]}"
182        done
183
184        if [ -z "${string_deps}" ]; then
185                errorAndLog "installDependencies(): array of dependeces is empty"
186                exit 1
187        fi
188
189        OLD_DEBIAN_FRONTEND=$DEBIAN_FRONTEND
190        export DEBIAN_FRONTEND=noninteractive
191
192        echoAndLog "installDependencies(): now ${string_deps} will be installed"
193        apt-get -y install --force-yes ${string_deps}
194        if [ $? -ne 0 ]; then
195                errorAndLog "installDependencies(): error installing dependencies"
196                return 1
197        fi
198
199        DEBIAN_FRONTEND=$OLD_DEBIAN_FRONTEND
200        echoAndLog "installDependencies(): dependencies installed"
201}
202
[13a01a7]203# Hace un backup del fichero pasado por parámetro
204# deja un -last y uno para el día
205function backupFile()
206{
207        if [ $# -ne 1 ]; then
208                errorAndLog "${FUNCNAME}(): invalid number of parameters"
209                exit 1
210        fi
211
212        local fichero=$1
213        local fecha=`date +%Y%m%d`
214
215        if [ ! -f $fichero ]; then
216                errorAndLog "${FUNCNAME}(): file $fichero doesn't exists"
217                return 1
218        fi
219
220        echoAndLog "${FUNCNAME}(): realizando backup de $fichero"
221
222        # realiza una copia de la última configuración como last
223        cp -p $fichero "${fichero}-LAST"
224
225        # si para el día no hay backup lo hace, sino no
226        if [ ! -f "${fichero}-${fecha}" ]; then
227                cp -p $fichero "${fichero}-${fecha}"
228        fi
229
230        echoAndLog "${FUNCNAME}(): backup realizado"
231}
232
[a01156a]233#####################################################################
234####### Funciones para el manejo de bases de datos
235#####################################################################
236
237# This function set password to root
[13a01a7]238function mysqlSetRootPassword()
[a01156a]239{
240        if [ $# -ne 1 ]; then
241                errorAndLog "mysqlSetRootPassword(): invalid number of parameters"
242                exit 1
243        fi
244
245        local root_mysql=$1
246        echoAndLog "mysqlSetRootPassword(): setting root password in MySQL server"
247        /usr/bin/mysqladmin -u root password ${root_mysql}
248        if [ $? -ne 0 ]; then
249                errorAndLog "mysqlSetRootPassword(): error while setting root password in MySQL server"
250                return 1
251        fi
252        echoAndLog "mysqlSetRootPassword(): root password saved!"
253        return 0
254}
255
[892606b9]256# Si el servicio mysql esta ya instalado cambia la variable de la clave del root por la ya existente
[13a01a7]257function mysqlGetRootPassword(){
[892606b9]258        local pass_mysql
259        local pass_mysql2
260        stty -echo
261        echo "Existe un servicio mysql ya instalado"
262        read -p  "Insertar clave de root de Mysql: " pass_mysql
263        echo ""
264        read -p "Confirmar clave:" pass_mysql2
265        echo ""
266        stty echo
267        if [ "$pass_mysql" == "$pass_mysql2" ] ;then
[8125e7c]268                MYSQL_ROOT_PASSWORD=$pass_mysql
[892606b9]269                echo "La clave es: ${MYSQL_ROOT_PASSWORD}"
270                return 0
271        else
272                echo "Las claves no coinciden no se configura la clave del servidor de base de datos."
273                echo "las operaciones con la base de datos daran error"
274                return 1
275        fi
276
277
278}
279
[a01156a]280# comprueba si puede conectar con mysql con el usuario root
281function mysqlTestConnection()
282{
283        if [ $# -ne 1 ]; then
284                errorAndLog "mysqlTestConnection(): invalid number of parameters"
285                exit 1
286        fi
287
288        local root_password="${1}"
289        echoAndLog "mysqlTestConnection(): checking connection to mysql..."
290        echo "" | mysql -uroot -p"${root_password}"
291        if [ $? -ne 0 ]; then
292                errorAndLog "mysqlTestConnection(): connection to mysql failed, check root password and if daemon is running!"
293                return 1
294        else
295                echoAndLog "mysqlTestConnection(): connection success"
296                return 0
297        fi
298}
299
300# comprueba si la base de datos existe
301function mysqlDbExists()
302{
303        if [ $# -ne 2 ]; then
304                errorAndLog "mysqlDbExists(): invalid number of parameters"
305                exit 1
306        fi
307
308        local root_password="${1}"
309        local database=$2
310        echoAndLog "mysqlDbExists(): checking if $database exists..."
311        echo "show databases" | mysql -uroot -p"${root_password}" | grep "^${database}$"
312        if [ $? -ne 0 ]; then
313                echoAndLog "mysqlDbExists():database $database doesn't exists"
314                return 1
315        else
316                echoAndLog "mysqlDbExists():database $database exists"
317                return 0
318        fi
319}
320
321function mysqlCheckDbIsEmpty()
322{
323        if [ $# -ne 2 ]; then
324                errorAndLog "mysqlCheckDbIsEmpty(): invalid number of parameters"
325                exit 1
326        fi
327
328        local root_password="${1}"
329        local database=$2
330        echoAndLog "mysqlCheckDbIsEmpty(): checking if $database is empty..."
331        num_tablas=`echo "show tables" | mysql -uroot -p"${root_password}" "${database}" | wc -l`
332        if [ $? -ne 0 ]; then
333                errorAndLog "mysqlCheckDbIsEmpty(): error executing query, check database and root password"
334                exit 1
335        fi
336
337        if [ $num_tablas -eq 0 ]; then
338                echoAndLog "mysqlCheckDbIsEmpty():database $database is empty"
339                return 0
340        else
341                echoAndLog "mysqlCheckDbIsEmpty():database $database has tables"
342                return 1
343        fi
344
345}
346
347
348function mysqlImportSqlFileToDb()
349{
350        if [ $# -ne 3 ]; then
[c5ce04c]351                errorAndLog "${FNCNAME}(): invalid number of parameters"
[a01156a]352                exit 1
353        fi
354
355        local root_password="${1}"
356        local database=$2
357        local sqlfile=$3
358
359        if [ ! -f $sqlfile ]; then
[c5ce04c]360                errorAndLog "${FUNCNAME}(): Unable to locate $sqlfile!!"
[a01156a]361                return 1
362        fi
363
[c5ce04c]364        echoAndLog "${FUNCNAME}(): importing sql file to ${database}..."
[be85bb2]365        perl -pi -e "s/SERVERIP/$SERVERIP/g; s/DEFAULTUSER/$OPENGNSYS_DB_DEFAULTUSER/g; s/DEFAULTPASSWD/$OPENGNSYS_DB_DEFAULTPASSWD/g" $sqlfile
[a01156a]366        mysql -uroot -p"${root_password}" "${database}" < $sqlfile
367        if [ $? -ne 0 ]; then
[c5ce04c]368                errorAndLog "${FUNCNAME}(): error while importing $sqlfile in database $database"
[a01156a]369                return 1
370        fi
[c5ce04c]371        echoAndLog "${FUNCNAME}(): file imported to database $database"
[a01156a]372        return 0
373}
374
375# Crea la base de datos
376function mysqlCreateDb()
377{
378        if [ $# -ne 2 ]; then
[a555f49]379                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[a01156a]380                exit 1
381        fi
382
383        local root_password="${1}"
384        local database=$2
385
[a555f49]386        echoAndLog "${FUNCNAME}(): creating database..."
[a01156a]387        mysqladmin -u root --password="${root_password}" create $database
388        if [ $? -ne 0 ]; then
[a555f49]389                errorAndLog "${FUNCNAME}(): error while creating database $database"
[a01156a]390                return 1
391        fi
[a555f49]392        echoAndLog "${FUNCNAME}(): database $database created"
[a01156a]393        return 0
394}
395
396
397function mysqlCheckUserExists()
398{
399        if [ $# -ne 2 ]; then
400                errorAndLog "mysqlCheckUserExists(): invalid number of parameters"
401                exit 1
402        fi
403
404        local root_password="${1}"
405        local userdb=$2
406
407        echoAndLog "mysqlCheckUserExists(): checking if $userdb exists..."
408        echo "select user from user where user='${userdb}'\\G" |mysql -uroot -p"${root_password}" mysql | grep user
409        if [ $? -ne 0 ]; then
410                echoAndLog "mysqlCheckUserExists(): user doesn't exists"
411                return 1
412        else
413                echoAndLog "mysqlCheckUserExists(): user already exists"
414                return 0
415        fi
416
417}
418
419# Crea un usuario administrativo para la base de datos
420function mysqlCreateAdminUserToDb()
421{
422        if [ $# -ne 4 ]; then
423                errorAndLog "mysqlCreateAdminUserToDb(): invalid number of parameters"
424                exit 1
425        fi
426
427        local root_password=$1
428        local database=$2
429        local userdb=$3
430        local passdb=$4
431
432        echoAndLog "mysqlCreateAdminUserToDb(): creating admin user ${userdb} to database ${database}"
433
434        cat > $WORKDIR/create_${database}.sql <<EOF
435GRANT USAGE ON *.* TO '${userdb}'@'localhost' IDENTIFIED BY '${passdb}' ;
436GRANT ALL PRIVILEGES ON ${database}.* TO '${userdb}'@'localhost' WITH GRANT OPTION ;
437FLUSH PRIVILEGES ;
438EOF
439        mysql -u root --password=${root_password} < $WORKDIR/create_${database}.sql
440        if [ $? -ne 0 ]; then
441                errorAndLog "mysqlCreateAdminUserToDb(): error while creating user in mysql"
442                rm -f $WORKDIR/create_${database}.sql
443                return 1
444        else
445                echoAndLog "mysqlCreateAdminUserToDb(): user created ok"
446                rm -f $WORKDIR/create_${database}.sql
447                return 0
448        fi
449}
450
451
452#####################################################################
453####### Funciones para el manejo de Subversion
454#####################################################################
455
[7586ca3]456function svnCheckoutCode()
[a01156a]457{
[9fb5086]458        if [ $# -ne 1 ]; then
[13a01a7]459                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[a01156a]460                exit 1
461        fi
462
463        local url=$1
464
[13a01a7]465        echoAndLog "${FUNCNAME}(): downloading subversion code..."
[a01156a]466
[892606b9]467        /usr/bin/svn co "${url}" opengnsys
[a01156a]468        if [ $? -ne 0 ]; then
[13a01a7]469                errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password"
[a01156a]470                return 1
471        fi
[13a01a7]472        echoAndLog "${FUNCNAME}(): subversion code downloaded"
[a01156a]473        return 0
474}
475
[13a01a7]476
477function svnExportCode()
478{
479        if [ $# -ne 1 ]; then
480                errorAndLog "${FUNCNAME}(): invalid number of parameters"
481                exit 1
482        fi
483
484        local url=$1
485
486        echoAndLog "${FUNCNAME}(): downloading subversion code..."
487
488        /usr/bin/svn export "${url}" opengnsys
489        if [ $? -ne 0 ]; then
490                errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password"
491                return 1
492        fi
493        echoAndLog "${FUNCNAME}(): subversion code downloaded"
494        return 0
495}
496
497
[892606b9]498############################################################
[7586ca3]499###  Detectar red
500############################################################
501
502function getNetworkSettings()
503{
504        # Variables globales definidas:
505        # - SERVERIP: IP local del servidor.
506        # - NETIP:    IP de la red.
507        # - NETMASK:  máscara de red.
508        # - NETBROAD: IP de difusión de la red.
509        # - ROUTERIP: IP del router.
510        # - DNSIP:    IP del servidor DNS.
511
512        echoAndLog "getNetworkSettings(): Detecting default network parameters."
[10023eb]513        SERVERIP=$(LANG=C ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | head -n1 | awk '{print $1}')
514        NETMASK=$(LANG=C ifconfig | grep 'Mask:'| grep -v '127.0.0.1' | cut -d: -f4 | head -n1 | awk '{print $1}')
515        NETBROAD=$(LANG=C ifconfig | grep 'Bcast:'| grep -v '127.0.0.1' | cut -d: -f3 | head -n1 | awk '{print $1}')
[13a01a7]516        NETIP=$(netstat -r | grep $NETMASK | head -n1 | awk '{print $1}')
[7586ca3]517        ROUTERIP=$(netstat -nr | awk '$1~/0\.0\.0\.0/ {print $2}')
[a555f49]518        DNSIP=$(awk '/nameserver/ {print $2}' /etc/resolv.conf | head -n1)
[7586ca3]519        if [ -z "$NETIP" -o -z "$NETMASK" ]; then
520                errorAndLog "getNetworkSettings(): Network not detected."
521                exit 1
522        fi
[cc7eab7]523
524        # Variables de ejecución de Apache
525        # - APACHE_RUN_USER
526        # - APACHE_RUN_GROUP
527        if [ -f /etc/apache2/envvars ]; then
528                source /etc/apache2/envvars
529        fi
530        APACHE_RUN_USER=${APACHE_RUN_USER:-"www-data"}
531        APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-"www-data"}
[7586ca3]532}
533
534
535############################################################
[892606b9]536### Esqueleto para el Servicio pxe y contenedor tftpboot ###
537############################################################
538
539function tftpConfigure() {
540        echo "Configurando el servicio tftp"
541        basetftp=/var/lib/tftpboot
542
543        # reiniciamos demonio internet ????? porque ????
544        /etc/init.d/openbsd-inetd start
545
546        # preparacion contenedor tftpboot
547        cp -pr /usr/lib/syslinux/ ${basetftp}/syslinux
548        cp /usr/lib/syslinux/pxelinux.0 ${basetftp}
549        # prepamos el directorio de la configuracion de pxe
550        mkdir -p ${basetftp}/pxelinux.cfg
551        cat > ${basetftp}/pxelinux.cfg/default <<EOF
552DEFAULT pxe
553
554LABEL pxe
555KERNEL linux
556APPEND initrd=initrd.gz ip=dhcp ro vga=788 irqpoll acpi=on
557EOF
558        # comprobamos el servicio tftp
559        sleep 1
560        testPxe
561        ## damos perfimos de lectura a usuario web.
[cc7eab7]562        chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP ${basetftp}
[892606b9]563}
564
565function testPxe () {
566        cd /tmp
567        echo "comprobando servicio pxe ..... Espere"
568        tftp -v localhost -c get pxelinux.0 /tmp/pxelinux.0 && echo "servidor tftp OK" || echo "servidor tftp KO"
569        cd /
570}
571
572########################################################################
[b6906f7]573## Configuracion servicio NFS
[892606b9]574########################################################################
575
[13a01a7]576# function nfsConfigure ()
577# {
578#         echoAndLog "${FUNCNAME}(): Sample NFS Configuration."
579#         sed -e "s/NETIP/$NETIP/g" -e "s/NETMASK/$NETMASK/g" $WORKDIR/opengnsys/server/NFS/exports  >> /etc/exports
580#       /etc/init.d/nfs-kernel-server restart
581#       exportfs -va
582#         echoAndLog "${FUNCNAME}(): Sample NFS Configured in file \"/etc/exports\"."
583# }
584
585# ADVERTENCIA: usa variables globales NETIP y NETMASK!
586function nfsConfigure()
[7586ca3]587{
[13a01a7]588        echoAndLog "${FUNCNAME}(): Config nfs server."
589
590        backupFile /etc/exports
591
592        nfsAddExport /opt/opengnsys/client ${NETIP}/${NETMASK}:ro,no_subtree_check,no_root_squash,sync
593        if [ $? -ne 0 ]; then
594                errorAndLog "${FUNCNAME}(): error while adding nfs client config"
595                return 1
596        fi
597
598        nfsAddExport /opt/opengnsys/images ${NETIP}/${NETMASK}:rw,no_subtree_check,no_root_squash,sync,crossmnt
599        if [ $? -ne 0 ]; then
600                errorAndLog "${FUNCNAME}(): error while adding nfs images config"
601                return 1
602        fi
603
604        nfsAddExport /opt/opengnsys/log/clients ${NETIP}/${NETMASK}:rw,no_subtree_check,no_root_squash,sync
605        if [ $? -ne 0 ]; then
606                errorAndLog "${FUNCNAME}(): error while adding logging client config"
607                return 1
608        fi
609
[7586ca3]610        /etc/init.d/nfs-kernel-server restart
[13a01a7]611
[b6906f7]612        exportfs -va
[13a01a7]613        if [ $? -ne 0 ]; then
614                errorAndLog "${FUNCNAME}(): error while configure exports"
615                return 1
616        fi
617
618        echoAndLog "${FUNCNAME}(): Added NFS configuration to file \"/etc/exports\"."
619        return 0
[b6906f7]620}
[892606b9]621
[b6906f7]622
[13a01a7]623# ejemplos:
624#nfsAddExport /opt/opengnsys 192.168.0.0/255.255.255.0:ro,no_subtree_check,no_root_squash,sync
625#nfsAddExport /opt/opengnsys 192.168.0.0/255.255.255.0
626#nfsAddExport /opt/opengnsys 80.20.2.1:ro 192.123.32.2:rw
627function nfsAddExport()
628{
629        if [ $# -lt 2 ]; then
630                errorAndLog "${FUNCNAME}(): invalid number of parameters"
631                exit 1
632        fi
633
634        if [ ! -f /etc/exports ]; then
635                errorAndLog "${FUNCNAME}(): /etc/exports don't exists"
636                return 1
637        fi
638
639        local export="${1}"
640        local contador=0
641        local cadenaexport
642
643        grep "^${export}" /etc/exports > /dev/null
644        if [ $? -eq 0 ]; then
645                echoAndLog "${FUNCNAME}(): $export exists in /etc/exports, omiting"
646                return 0
647        fi
648
649        cadenaexport="${export}"
650        for parametro in $*
651        do
652                if [ $contador -gt 0 ]
653                then
654                        host=`echo $parametro | awk -F: '{print $1}'`
655                        options=`echo $parametro | awk -F: '{print $2}'`
656                        if [ "${host}" == "" ]; then
657                                errorAndLog "${FUNCNAME}(): host can't be empty"
658                                return 1
659                        fi
660                        cadenaexport="${cadenaexport}\t${host}"
661
662                        if [ "${options}" != "" ]; then
663                                cadenaexport="${cadenaexport}(${options})"
664                        fi
665                fi
666                let contador=contador+1
667        done
668
669        echo -en "$cadenaexport\n" >> /etc/exports
670
671        echoAndLog "${FUNCNAME}(): add $export to /etc/exports"
672
673        return 0
674}
675
[b6906f7]676########################################################################
677## Configuracion servicio DHCP
678########################################################################
679
[7586ca3]680function dhcpConfigure()
681{
[a555f49]682        echoAndLog "${FUNCNAME}(): Sample DHCP Configuration."
683
684        backupFile /etc/dhcp3/dhcpd.conf
685
[7586ca3]686        sed -e "s/SERVERIP/$SERVERIP/g" \
687            -e "s/NETIP/$NETIP/g" \
688            -e "s/NETMASK/$NETMASK/g" \
689            -e "s/NETBROAD/$NETBROAD/g" \
690            -e "s/ROUTERIP/$ROUTERIP/g" \
691            -e "s/DNSIP/$DNSIP/g" \
692            $WORKDIR/opengnsys/server/DHCP/dhcpd.conf > /etc/dhcp3/dhcpd.conf
[a555f49]693        if [ $? -ne 0 ]; then
694                errorAndLog "${FUNCNAME}(): error while configuring dhcp server"
695                return 1
696        fi
697
[7586ca3]698        /etc/init.d/dhcp3-server restart
[a555f49]699        echoAndLog "${FUNCNAME}(): Sample DHCP Configured in file \"/etc/dhcp3/dhcpd.conf\"."
700        return 0
[892606b9]701}
702
703
[a01156a]704#####################################################################
705####### Funciones específicas de la instalación de Opengnsys
706#####################################################################
707
[7586ca3]708# Copiar ficheros del OpenGNSys Web Console.
709function installWebFiles()
710{
[dce072b]711        echoAndLog "${FUNCNAME}(): Installing web files..."
[7586ca3]712        cp -ar $WORKDIR/opengnsys/admin/WebConsole/* $INSTALL_TARGET/www   #*/ comentario para doxigen
713        if [ $? != 0 ]; then
[dce072b]714                errorAndLog "${FUNCNAME}(): Error copying web files."
[7586ca3]715                exit 1
716        fi
717        find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null
718        # Cambiar permisos para ficheros especiales.
[cc7eab7]719        chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP \
720                        $INSTALL_TARGET/www/includes \
721                        $INSTALL_TARGET/www/comandos/gestores/filescripts \
[dce072b]722                        $INSTALL_TARGET/www/images/iconos
723        echoAndLog "${FUNCNAME}(): Web files installed successfully."
[7586ca3]724}
725
726# Configuración específica de Apache.
[892606b9]727function openGnsysInstallWebConsoleApacheConf()
[a01156a]728{
729        if [ $# -ne 2 ]; then
[dce072b]730                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[a01156a]731                exit 1
732        fi
733
734        local path_opengnsys_base=$1
735        local path_apache2_confd=$2
[892606b9]736        local path_web_console=${path_opengnsys_base}/www
[a01156a]737
[892606b9]738        if [ ! -d $path_apache2_confd ]; then
[dce072b]739                errorAndLog "${FUNCNAME}(): path to apache2 conf.d can not found, verify your server installation"
[892606b9]740                return 1
741        fi
742
[7586ca3]743        mkdir -p $path_apache2_confd/{sites-available,sites-enabled}
[892606b9]744
[dce072b]745        echoAndLog "${FUNCNAME}(): creating apache2 config file.."
[a01156a]746
747        # genera configuración
[892606b9]748        cat > $path_opengnsys_base/etc/apache.conf <<EOF
[cc7eab7]749# OpenGNSys Web Console configuration for Apache
[a01156a]750
[892606b9]751Alias /opengnsys ${path_web_console}
[a01156a]752
[892606b9]753<Directory ${path_web_console}>
[a01156a]754        Options -Indexes FollowSymLinks
755        DirectoryIndex acceso.php
756</Directory>
757EOF
758
[7586ca3]759        ln -fs $path_opengnsys_base/etc/apache.conf $path_apache2_confd/sites-available/opengnsys.conf
760        ln -fs $path_apache2_confd/sites-available/opengnsys.conf $path_apache2_confd/sites-enabled/opengnsys.conf
[a01156a]761        if [ $? -ne 0 ]; then
[dce072b]762                errorAndLog "${FUNCNAME}(): config file can't be linked to apache conf, verify your server installation"
[a01156a]763                return 1
764        else
[dce072b]765                echoAndLog "${FUNCNAME}(): config file created and linked, restarting apache daemon"
[077dd7c5]766                /etc/init.d/apache2 restart
[a01156a]767                return 0
768        fi
769}
770
771# Crea la estructura base de la instalación de opengnsys
[318efac]772function openGnsysInstallCreateDirs()
[a01156a]773{
774        if [ $# -ne 1 ]; then
[dce072b]775                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[a01156a]776                exit 1
777        fi
778
779        local path_opengnsys_base=$1
780
[dce072b]781        echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base"
[a01156a]782
783        mkdir -p $path_opengnsys_base
[077dd7c5]784        mkdir -p $path_opengnsys_base/admin/{autoexec,comandos,menus,usuarios}
[a01156a]785        mkdir -p $path_opengnsys_base/bin
[5c33840]786        mkdir -p $path_opengnsys_base/client
787        mkdir -p $path_opengnsys_base/etc
[a01156a]788        mkdir -p $path_opengnsys_base/lib
[1cc5697]789        mkdir -p $path_opengnsys_base/log/clients
[7586ca3]790        mkdir -p $path_opengnsys_base/sbin
[a01156a]791        mkdir -p $path_opengnsys_base/www
[5c33840]792        mkdir -p $path_opengnsys_base/images
[b6906f7]793        ln -fs /var/lib/tftpboot $path_opengnsys_base
794        ln -fs $path_opengnsys_base/log /var/log/opengnsys
[5c33840]795
[a01156a]796        if [ $? -ne 0 ]; then
[dce072b]797                errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
[a01156a]798                return 1
799        fi
800
[dce072b]801        echoAndLog "${FUNCNAME}(): directory paths created"
[a01156a]802        return 0
803}
804
[463a1d49]805# Copia ficheros de configuración y ejecutables genéricos del servidor.
[318efac]806function openGnsysCopyServerFiles () {
[463a1d49]807        if [ $# -ne 1 ]; then
[879689f]808                errorAndLog "${FUNCNAME}(): invalid number of parameters"
[463a1d49]809                exit 1
810        fi
811
812        local path_opengnsys_base=$1
813
[892606b9]814        local SOURCES=( client/boot/initrd-generator \
[b6906f7]815                        client/boot/upgrade-clients-udeb.sh \
[a555f49]816                        client/boot/udeblist.conf  \
817                        client/boot/udeblist-jaunty.conf  \
[879689f]818                        client/boot/udeblist-karmic.conf \
819                        server/PXE/pxelinux.cfg/default )
[892606b9]820        local TARGETS=( bin/initrd-generator \
[b6906f7]821                        bin/upgrade-clients-udeb.sh \
[a555f49]822                        etc/udeblist.conf \
823                        etc/udeblist-jaunty.conf  \
[879689f]824                        etc/udeblist-karmic.conf \
825                        tftpboot/pxelinux.cfg/default )
[463a1d49]826
827        if [ ${#SOURCES[@]} != ${#TARGETS[@]} ]; then
[879689f]828                errorAndLog "${FUNCNAME}(): inconsistent number of array items"
[463a1d49]829                exit 1
830        fi
831
[879689f]832        echoAndLog "${FUNCNAME}(): copying files to server directories"
[f2bb433]833
[1e7eaab]834        [ $USESVN ] && pushd $WORKDIR/opengnsys
[463a1d49]835        local i
836        for (( i = 0; i < ${#SOURCES[@]}; i++ )); do
837                if [ -f "${SOURCES[$i]}" ]; then
[879689f]838                        echoAndLog "Copying ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
[463a1d49]839                        cp -p "${SOURCES[$i]}" "${path_opengnsys_base}/${TARGETS[$i]}"
840                fi
841                if [ -d "${SOURCES[$i]}" ]; then
[879689f]842                        echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
[7586ca3]843                        cp -ar "${SOURCES[$i]}/*" "${path_opengnsys_base}/${TARGETS[$i]}"
[463a1d49]844                fi
845        done
[7586ca3]846        popd
[892606b9]847}
848
[7586ca3]849####################################################################
850### Funciones de compilación de códifo fuente de servicios
851####################################################################
852
[b6906f7]853# Compilar los servicios de OpenGNsys
[7586ca3]854function servicesCompilation ()
855{
[13a01a7]856        local hayErrores=0
[0795938]857
[b6906f7]858        # Compilar OpenGNSys Server
[13a01a7]859        echoAndLog "${FUNCNAME}(): Compiling OpenGNSys Admin Server"
[318efac]860        pushd $WORKDIR/opengnsys/admin/Services/ogAdmServer
[b6906f7]861        make && make install
[13a01a7]862        if [ $? -ne 0 ]; then
863                echoAndLog "${FUNCNAME}(): error while compiling OpenGNSys Admin Server"
864                hayErrores=1
865        fi
[7586ca3]866        popd
[b6906f7]867        # Compilar OpenGNSys Repository Manager
[13a01a7]868        echoAndLog "${FUNCNAME}(): Compiling OpenGNSys Repository Manager"
[318efac]869        pushd $WORKDIR/opengnsys/admin/Services/ogAdmRepo
[b6906f7]870        make && make install
[13a01a7]871        if [ $? -ne 0 ]; then
872                echoAndLog "${FUNCNAME}(): error while compiling OpenGNSys Repository Manager"
873                hayErrores=1
874        fi
[8125e7c]875        popd
[b6906f7]876        # Compilar OpenGNSys Client
[dce072b]877        echoAndLog "${FUNCNAME}(): Compiling OpenGNSys Admin Client"
[318efac]878        pushd $WORKDIR/opengnsys/admin/Services/ogAdmClient
879        make && mv ogAdmClient ../../../client/nfsexport/bin
[13a01a7]880        if [ $? -ne 0 ]; then
881                echoAndLog "${FUNCNAME}(): error while compiling OpenGNSys Admin Client"
882                hayErrores=1
883        fi
[318efac]884        popd
[13a01a7]885
886        return $hayErrores
[b6906f7]887}
888
889
[892606b9]890####################################################################
891### Funciones instalacion cliente opengnsys
892####################################################################
893
[a555f49]894function openGnsysClientCreate()
[7586ca3]895{
896        local OSDISTRIB OSCODENAME
[892606b9]897
[a555f49]898        local hayErrores=0
899
900        echoAndLog "${FUNCNAME}(): Copying OpenGNSys Client files."
[892606b9]901        cp -ar $WORKDIR/opengnsys/client/nfsexport/* $INSTALL_TARGET/client
[b6906f7]902        find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null
[a555f49]903        echoAndLog "${FUNCNAME}(): Copying OpenGNSys Cloning Engine files."
[b6906f7]904        mkdir -p $INSTALL_TARGET/client/lib/engine/bin
[892606b9]905        cp -ar $WORKDIR/opengnsys/client/engine/*.lib $INSTALL_TARGET/client/lib/engine/bin
[a555f49]906        if [ $? -ne 0 ]; then
907                errorAndLog "${FUNCNAME}(): error while copying engine files"
908                hayErrores=1
909        fi
[892606b9]910
[cc7eab7]911        # Cargar Kernel, Initrd y paquetes udeb para la distribución del servidor (o por defecto).
[d345fa6]912        OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
913        OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
[7586ca3]914        if [ "$OSDISTRIB" = "Ubuntu" -a -n "$OSCODENAME" ]; then
[a555f49]915                echoAndLog "${FUNCNAME}(): Loading Kernel and Initrd files for $OSDISTRIB $OSCODENAME."
[7586ca3]916                $INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot -v "$OSCODENAME"
[a555f49]917                if [ $? -ne 0 ]; then
918                        errorAndLog "${FUNCNAME}(): error while generating initrd OpenGNSys Admin Client"
919                        hayErrores=1
920                fi
921                echoAndLog "${FUNCNAME}(): Loading udeb files for $OSDISTRIB $OSCODENAME."
[7586ca3]922                $INSTALL_TARGET/bin/upgrade-clients-udeb.sh "$OSCODENAME"
[a555f49]923                if [ $? -ne 0 ]; then
924                        errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGNSys Admin Client"
925                        hayErrores=1
926                fi
[7586ca3]927        else
[a555f49]928                echoAndLog "${FUNCNAME}(): Loading default Kernel and Initrd files."
[7586ca3]929                $INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot/
[a555f49]930                if [ $? -ne 0 ]; then
931                        errorAndLog "${FUNCNAME}(): error while generating initrd OpenGNSys Admin Client"
932                        hayErrores=1
933                fi
934                echoAndLog "${FUNCNAME}(): Loading default udeb files."
[7586ca3]935                $INSTALL_TARGET/bin/upgrade-clients-udeb.sh
[a555f49]936                if [ $? -ne 0 ]; then
937                        errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGNSys Admin Client"
938                        hayErrores=1
939                fi
940        fi
941
942        if [ $hayErrores -eq 0 ]; then
943                echoAndLog "${FUNCNAME}(): Client generation success."
944        else
945                errorAndLog "${FUNCNAME}(): Client generation with errors"
[7586ca3]946        fi
[a555f49]947
948        return $hayErrores
[463a1d49]949}
950
951
[cc7eab7]952# Configuración básica de servicios de OpenGNSys
953function openGnsysConfigure()
954{
955        echoAndLog "openGnsysConfigure(): Copying init files."
956        cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.init /etc/init.d/opengnsys
957        cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.default /etc/default/opengnsys
958        update-rc.d opengnsys defaults
959        echoAndLog "openGnsysConfigure(): Creating OpenGNSys config file in \"$INSTALL_TARGET/etc\"."
[1a22cd2]960        perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmServer.cfg
961        perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmRepo.cfg
[ea7186c]962        echoAndLog "${FUNCNAME}(): Creating Web Console config file"
963        OPENGNSYS_CONSOLEURL="http://$SERVERIP/opengnsys"
964        perl -pi -e "s/SERVERIP/$SERVERIP/g; s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $INSTALL_TARGET/www/controlacceso.php
965        sed -e "s/SERVERIP/$SERVERIP/g" -e "s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $WORKDIR/opengnsys/admin/Services/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient.cfg
[cc7eab7]966        echoAndLog "openGnsysConfiguration(): Starting OpenGNSys services."
967        /etc/init.d/opengnsys start
968}
969
[b6906f7]970
[a01156a]971#####################################################################
[180a07dd]972#######  Función de resumen informativo de la instalación
973#####################################################################
974
975function installationSummary(){
976        echo
977        echoAndLog "OpenGNSys Installation Summary"
978        echo       "=============================="
979        echoAndLog "OpenGNSys installation directory: $INSTALL_TARGET"
980        echoAndLog "OpenGNSys repository directory:   $INSTALL_TARGET/images"
981        echoAndLog "TFTP configuracion directory:     /var/lib/tftpboot"
982        echoAndLog "DHCP configuracion file:          /etc/dhcp3/dhcpd.conf"
983        echoAndLog "NFS configuracion file:           /etc/exports"
984        echoAndLog "OpenGNSys Web Console URL:        $OPENGNSYS_CONSOLEURL"
985        echoAndLog "Web Console admin user:           $OPENGNSYS_DB_USER"
986        echoAndLog "Web Console admin password:       $OPENGNSYS_DB_PASSWD"
[c5ce04c]987        echoAndLog "Web Console default user:         $OPENGNSYS_DB_DEFAULTUSER"
988        echoAndLog "Web Console default password:     $OPENGNSYS_DB_DEFAULTPASSWD"
[180a07dd]989        echo
990        echoAndLog "Post-Installation Instructions:"
991        echo       "==============================="
992        echoAndLog "Review or edit all configuration files."
[c5ce04c]993        echoAndLog "Insert DHCP configuration data and restart service."
[180a07dd]994        echoAndLog "Log-in as Web Console admin user."
[c5ce04c]995        echoAndLog " - Review default Organization data and default user."
[180a07dd]996        echoAndLog "Log-in as Web Console organization user."
[c5ce04c]997        echoAndLog " - Insert OpenGNSys data (rooms, computers, etc)."
[180a07dd]998echo
999}
1000
1001
1002
1003#####################################################################
[b6906f7]1004####### Proceso de instalación de OpenGNSys
[a01156a]1005#####################################################################
1006
[7586ca3]1007
[cc7eab7]1008echoAndLog "OpenGNSys installation begins at $(date)"
1009
[7586ca3]1010# Detectar parámetros de red por defecto
1011getNetworkSettings
1012if [ $? -ne 0 ]; then
1013        errorAndLog "Error reading default network settings."
1014        exit 1
1015fi
1016
[318efac]1017# Actualizar repositorios
1018apt-get update
1019
[b6906f7]1020# Instalación de dependencias (paquetes de sistema operativo).
[a01156a]1021declare -a notinstalled
1022checkDependencies DEPENDENCIES notinstalled
1023if [ $? -ne 0 ]; then
1024        installDependencies notinstalled
1025        if [ $? -ne 0 ]; then
1026                echoAndLog "Error while installing some dependeces, please verify your server installation before continue"
1027                exit 1
1028        fi
1029fi
1030
[b6906f7]1031# Arbol de directorios de OpenGNSys.
[a01156a]1032openGnsysInstallCreateDirs ${INSTALL_TARGET}
1033if [ $? -ne 0 ]; then
1034        errorAndLog "Error while creating directory paths!"
1035        exit 1
1036fi
[b6906f7]1037
[1e7eaab]1038# Si es necesario, descarga el repositorio de código en directorio temporal
1039if [ $USESVN ]; then
1040        #svnCheckoutCode $SVN_URL
1041        svnExportCode $SVN_URL
1042        if [ $? -ne 0 ]; then
1043                errorAndLog "Error while getting code from svn"
1044                exit 1
1045        fi
1046else
1047        ln -fs "$(dirname $PROGRAMDIR)" opengnsys
[a01156a]1048fi
1049
[b6906f7]1050# Compilar código fuente de los servicios de OpenGNSys.
1051servicesCompilation
[13a01a7]1052if [ $? -ne 0 ]; then
1053        errorAndLog "Error while compiling OpenGnsys services"
1054        exit 1
1055fi
[b6906f7]1056
1057# Configurando tftp
[318efac]1058tftpConfigure
[b6906f7]1059
1060# Configuración NFS
1061nfsConfigure
[13a01a7]1062if [ $? -ne 0 ]; then
1063        errorAndLog "Error while configuring nfs server!"
1064        exit 1
1065fi
[b6906f7]1066
1067# Configuración ejemplo DHCP
1068dhcpConfigure
[a555f49]1069if [ $? -ne 0 ]; then
1070        errorAndLog "Error while copying your dhcp server files!"
1071        exit 1
1072fi
[b6906f7]1073
1074# Copiar ficheros de servicios OpenGNSys Server.
[463a1d49]1075openGnsysCopyServerFiles ${INSTALL_TARGET}
1076if [ $? -ne 0 ]; then
1077        errorAndLog "Error while copying the server files!"
1078        exit 1
1079fi
1080
[b6906f7]1081# Instalar Base de datos de OpenGNSys Admin.
1082isInArray notinstalled "mysql-server"
1083if [ $? -eq 0 ]; then
1084        mysqlSetRootPassword ${MYSQL_ROOT_PASSWORD}
1085else
1086        mysqlGetRootPassword
1087
1088fi
[463a1d49]1089
[a01156a]1090mysqlTestConnection ${MYSQL_ROOT_PASSWORD}
1091if [ $? -ne 0 ]; then
1092        errorAndLog "Error while connection to mysql"
1093        exit 1
1094fi
[892606b9]1095mysqlDbExists ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE}
[a01156a]1096if [ $? -ne 0 ]; then
[cc7eab7]1097        echoAndLog "Creating Web Console database"
[892606b9]1098        mysqlCreateDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE}
[a01156a]1099        if [ $? -ne 0 ]; then
[cc7eab7]1100                errorAndLog "Error while creating Web Console database"
[a01156a]1101                exit 1
1102        fi
1103else
[cc7eab7]1104        echoAndLog "Web Console database exists, ommiting creation"
[a01156a]1105fi
1106
[892606b9]1107mysqlCheckUserExists ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DB_USER}
[a01156a]1108if [ $? -ne 0 ]; then
1109        echoAndLog "Creating user in database"
[892606b9]1110        mysqlCreateAdminUserToDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} ${OPENGNSYS_DB_USER} "${OPENGNSYS_DB_PASSWD}"
[a01156a]1111        if [ $? -ne 0 ]; then
[cc7eab7]1112                errorAndLog "Error while creating database user"
[a01156a]1113                exit 1
1114        fi
1115
1116fi
1117
[892606b9]1118mysqlCheckDbIsEmpty ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE}
[a01156a]1119if [ $? -eq 0 ]; then
1120        echoAndLog "Creating tables..."
[892606b9]1121        if [ -f $WORKDIR/$OPENGNSYS_DB_CREATION_FILE ]; then
1122                mysqlImportSqlFileToDb ${MYSQL_ROOT_PASSWORD} ${OPENGNSYS_DATABASE} $WORKDIR/$OPENGNSYS_DB_CREATION_FILE
[a01156a]1123        else
[892606b9]1124                errorAndLog "Unable to locate $WORKDIR/$OPENGNSYS_DB_CREATION_FILE!!"
[a01156a]1125                exit 1
1126        fi
1127fi
1128
1129# copiando paqinas web
[7586ca3]1130installWebFiles
[a01156a]1131
1132# creando configuracion de apache2
[892606b9]1133openGnsysInstallWebConsoleApacheConf $INSTALL_TARGET /etc/apache2
[a01156a]1134if [ $? -ne 0 ]; then
[7586ca3]1135        errorAndLog "Error configuring Apache for OpenGNSYS Admin"
[a01156a]1136        exit 1
1137fi
1138
1139popd
[892606b9]1140
1141# Creando la estructura del cliente
1142openGnsysClientCreate
[a555f49]1143if [ $? -ne 0 ]; then
1144        errorAndLog "Error creating clients"
1145        exit 1
1146fi
[892606b9]1147
[cc7eab7]1148# Configuración de servicios de OpenGNSys
1149openGnsysConfigure
[2308fc7]1150
[180a07dd]1151# Mostrar sumario de la instalación e instrucciones de post-instalación.
1152installationSummary
1153
[077dd7c5]1154#rm -rf $WORKDIR
[cc7eab7]1155echoAndLog "OpenGNSys installation finished at $(date)"
[2308fc7]1156
Note: See TracBrowser for help on using the repository browser.