source: installer/opengnsys_installer.sh @ 0beb818

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 0beb818 was e4b1572, checked in by ramon <ramongomez@…>, 13 years ago

Versión 1.0.3, #410: Mejoras en instalador para configuración de DHCP y reusar funciones para NFS.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2462 a21b9725-9963-47de-94b9-378ad31fedc9

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