source: installer/opengnsys_update.sh @ b8774e7

Last change on this file since b8774e7 was 4816ea5, checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago

#971 Remove ogAdmAgent initialization

All the functionalities of the ogAdmAgent are now in the ogAdmServer.
So, the it is not needed anymore.

This commit remove the installation and update of the ogAdmAgent, adds a
check to remove it if exists and removes it from the OpenGnsys init
script.

A future patch will remove all the code related to the ogAdmAgent.

  • Property mode set to 100755
File size: 44.8 KB
RevLine 
[a0867b37]1#!/bin/bash
2#/**
3#@file    opengnsys_update.sh
[5f21d34]4#@brief   Script actualización de OpenGnsys
[a0867b37]5#@version 0.9 - basado en opengnsys_installer.sh
6#@author  Ramón Gómez - ETSII Univ. Sevilla
7#@date    2010/01/27
[c1e00e4]8#@version 1.0 - adaptación a OpenGnSys 1.0
9#@author  Ramón Gómez - ETSII Univ. Sevilla
10#@date    2011/03/02
[64dd765]11#@version 1.0.1 - control de auto actualización del script
12#@author  Ramón Gómez - ETSII Univ. Sevilla
13#@date    2011/05/17
[739fb00]14#@version 1.0.2a - obtiene valor de dirección IP por defecto
15#@author  Ramón Gómez - ETSII Univ. Sevilla
16#@date    2012/01/18
[1175096]17#@version 1.0.3 - Compatibilidad con Debian y auto configuración de acceso a BD.
[7bb72f7]18#@author  Ramón Gómez - ETSII Univ. Sevilla
[1175096]19#@date    2012/03/12
[db9e706]20#@version 1.0.4 - Detector de distribución y compatibilidad con CentOS.
21#@author  Ramón Gómez - ETSII Univ. Sevilla
22#@date    2012/05/04
[dde65c7]23#@version 1.0.5 - Actualizar BD en la misma versión, compatibilidad con Fedora (systemd) y configuración de Rsync.
[0b8a1f1]24#@author  Ramón Gómez - ETSII Univ. Sevilla
[dde65c7]25#@date    2014/04/03
[1a2fa9d8]26#@version 1.0.6 - Redefinir URLs de ficheros de configuración usando HTTPS.
27#@author  Ramón Gómez - ETSII Univ. Sevilla
28#@date    2015/03/12
[a3855dc]29#@version 1.1.0 - Instalación de API REST y configuración de zona horaria.
[900be258]30#@author  Ramón Gómez - ETSII Univ. Sevilla
[a3855dc]31#@date    2015/11/09
[fd45e9a]32#@version 1.1.1a - Elegir versión a actualizar.
33#@author  Ramón Gómez - ETSII Univ. Sevilla
34#@date    2019/12/13
[a0867b37]35#*/
36
37
[1175096]38####  AVISO: NO EDITAR variables de configuración.
39####  WARNING: DO NOT EDIT configuration variables.
40INSTALL_TARGET=/opt/opengnsys           # Directorio de instalación
[ec045b1]41PATH=$PATH:$INSTALL_TARGET/bin
[295b4ab]42OPENGNSYS_CLIENTUSER="opengnsys"        # Usuario Samba
43
44
[a0867b37]45# Sólo ejecutable por usuario root
[6ef01d9]46if [ "$(whoami)" != 'root' ]; then
[a0867b37]47        echo "ERROR: this program must run under root privileges!!"
48        exit 1
49fi
[5f21d34]50# Error si OpenGnsys no está instalado (no existe el directorio del proyecto)
[4e51cb0]51if [ ! -d $INSTALL_TARGET ]; then
[5f21d34]52        echo "ERROR: OpenGnsys is not installed, cannot update!!"
[4e51cb0]53        exit 1
54fi
[1175096]55# Cargar configuración de acceso a la base de datos.
56if [ -r $INSTALL_TARGET/etc/ogAdmServer.cfg ]; then
57        source $INSTALL_TARGET/etc/ogAdmServer.cfg
58fi
[42a0e41]59OPENGNSYS_DATABASE=${OPENGNSYS_DATABASE:-"$CATALOG"}            # Base de datos
[1175096]60OPENGNSYS_DBUSER=${OPENGNSYS_DBUSER:-"$USUARIO"}                # Usuario de acceso
61OPENGNSYS_DBPASSWORD=${OPENGNSYS_DBPASSWORD:-"$PASSWORD"}       # Clave del usuario
62if [ -z "$OPENGNSYS_DATABASE" -o -z "$OPENGNSYS_DBUSER" -o -z "$OPENGNSYS_DBPASSWORD" ]; then
63        echo "ERROR: set OPENGNSYS_DATABASE, OPENGNSYS_DBUSER and OPENGNSYS_DBPASSWORD"
64        echo "       variables, and run this script again."
[0304465]65        exit 1
[1175096]66fi
[a0867b37]67
[884b6ce]68# Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1).
[a0867b37]69PROGRAMDIR=$(readlink -e $(dirname "$0"))
[64dd765]70PROGRAMNAME=$(basename "$0")
[a0081b7]71OPENGNSYS_SERVER="opengnsys.es"
[a0867b37]72if [ -d "$PROGRAMDIR/../installer" ]; then
[884b6ce]73        REMOTE=0
[a0867b37]74else
[884b6ce]75        REMOTE=1
[a0867b37]76fi
77
78WORKDIR=/tmp/opengnsys_update
79mkdir -p $WORKDIR
80
[42a0e41]81# Registro de incidencias.
82OGLOGFILE=$INSTALL_TARGET/log/${PROGRAMNAME%.sh}.log
[57f7e9c]83LOG_FILE=/tmp/$(basename $OGLOGFILE)
[a0867b37]84
85
86
87#####################################################################
88####### Algunas funciones útiles de propósito general:
89#####################################################################
[295b4ab]90
[db9e706]91# Generar variables de configuración del actualizador
92# Variables globales:
[2e38f60]93# - OSDISTRIB - distribución Linux
[db9e706]94# - DEPENDENCIES - array de dependencias que deben estar instaladas
95# - UPDATEPKGLIST, INSTALLPKGS, CHECKPKG - comandos para gestión de paquetes
[3b0436d]96# - APACHECFGDIR, APACHESERV, PHPFPMSERV, DHCPSERV, MYSQLSERV, MYSQLCFGDIR, INETDCFGDIR - configuración y servicios
[ec536c6]97
[db9e706]98function autoConfigure()
99{
[a37e5fc4]100        local service
[2e38f60]101
[a37e5fc4]102        # Detectar sistema operativo del servidor (compatible con fichero os-release y con LSB).
103        if [ -f /etc/os-release ]; then
104                source /etc/os-release
105                OSDISTRIB="$ID"
106                OSVERSION="$VERSION_ID"
107        else
108                OSDISTRIB=$(lsb_release -is 2>/dev/null)
109                OSVERSION=$(lsb_release -rs 2>/dev/null)
110        fi
111        # Convertir distribución a minúsculas y obtener solo el 1er número de versión.
112        OSDISTRIB="${OSDISTRIB,,}"
113        OSVERSION="${OSVERSION%%.*}"
114
115        # Configuración según la distribución de Linux.
116        if [ -f /etc/debian_version ]; then
[884b6ce]117                # Distribución basada en paquetes Deb.
[c089f29]118                DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast libev-dev libjansson-dev libssl-dev shim-signed grub-efi-amd64-signed php-fpm gawk libdbi-dev libdbi1 libdbd-mysql)
[42c7e5f]119                # Paquete correcto para realpath.
120                [ -z "$(apt-cache pkgnames realpath)" ] && DEPENDENCIES=( ${DEPENDENCIES[@]//realpath/coreutils} )
[0304465]121                UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update"
[a37e5fc4]122                INSTALLPKGS="apt-get -y install"
123                DELETEPKGS="apt-get -y purge"
[db9e706]124                CHECKPKG="dpkg -s \$package 2>/dev/null | grep -q \"Status: install ok\""
[4b96166]125                if which service &>/dev/null; then
126                        STARTSERVICE="eval service \$service restart"
[dde65c7]127                        STOPSERVICE="eval service \$service stop"
[a37e5fc4]128                        SERVICESTATUS="eval service \$service status"
[4b96166]129                else
130                        STARTSERVICE="eval /etc/init.d/\$service restart"
[dde65c7]131                        STOPSERVICE="eval /etc/init.d/\$service stop"
[a37e5fc4]132                        SERVICESTATUS="eval /etc/init.d/\$service status"
[4b96166]133                fi
134                ENABLESERVICE="eval update-rc.d \$service defaults"
[9215580]135                APACHEENABLEMODS="ssl rewrite proxy_fcgi fastcgi actions alias"
136                APACHEDISABLEMODS="php"
[2e38f60]137                APACHEUSER="www-data"
138                APACHEGROUP="www-data"
[3b0436d]139                MYSQLCFGDIR=/etc/mysql/mysql.conf.d
140                MYSQLSERV="mysql"
[ec536c6]141                PHPFPMSERV="php-fpm"
[65baf16]142                INETDCFGDIR=/etc/xinetd.d
[a37e5fc4]143        elif [ -f /etc/redhat-release ]; then
[884b6ce]144                # Distribución basada en paquetes rpm.
[c089f29]145                DEPENDENCIES=( curl rsync btrfs-progs procps-ng arp-scan gettext moreutils jq net-tools udpcast libev-devel jansson-devel openssl-devel shim-x64 grub2-efi-x64 grub2-efi-x64-modules gawk libdbi-devel libdbi libdbi-dbd-mysql)
[ec536c6]146                # Repositorios para PHP 7 en CentOS.
147                [ "$OSDISTRIB" == "centos" ] && UPDATEPKGLIST="yum update -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OSVERSION.noarch.rpm http://rpms.remirepo.net/enterprise/remi-release-$OSVERSION.rpm"
[db9e706]148                INSTALLPKGS="yum install -y"
[a37e5fc4]149                DELETEPKGS="yum remove -y"
[db9e706]150                CHECKPKG="rpm -q --quiet \$package"
[4b96166]151                if which systemctl &>/dev/null; then
[a37e5fc4]152                        STARTSERVICE="eval systemctl restart \$service.service"
[dde65c7]153                        STOPSERVICE="eval systemctl stop \$service.service"
[4b96166]154                        ENABLESERVICE="eval systemctl enable \$service.service"
[a37e5fc4]155                        SERVICESTATUS="eval systemctl status \$service.service"
[4b96166]156                else
[a37e5fc4]157                        STARTSERVICE="eval service \$service restart"
[dde65c7]158                        STOPSERVICE="eval service \$service stop"
[4b96166]159                        ENABLESERVICE="eval chkconfig \$service on"
[a37e5fc4]160                        SERVICESTATUS="eval service \$service status"
[4b96166]161                fi
[2a5c1a4]162                APACHEUSER="apache"
163                APACHEGROUP="apache"
[3b0436d]164                MYSQLCFGDIR=/etc/my.cnf.d
165                MYSQLSERV="mariadb"
[ec536c6]166                PHPFPMSERV="php-fpm"
[65baf16]167                INETDCFGDIR=/etc/xinetd.d
[a37e5fc4]168        else
169                # Otras distribuciones.
170                :
171        fi
172        for service in apache2 httpd; do
[5050850]173                [ -d "/etc/$service" ] && APACHECFGDIR="/etc/$service"
[a37e5fc4]174                if $SERVICESTATUS &>/dev/null; then APACHESERV="$service"; fi
175        done
176        for service in dhcpd dhcpd3-server isc-dhcp-server; do
177                if $SERVICESTATUS &>/dev/null; then DHCPSERV="$service"; fi
178        done
[db9e706]179}
180
181
[fd45e9a]182# Choose an available version to update.
183function chooseVersion()
184{
185    local RELEASES DOWNLOADS INSTVERSION INSTRELEASE
186
187    # Development branch.
188    BRANCH="master"
189    API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH"
[66432fb]190
191    RELEASES=( )
192    DOWNLOADS=( )
[fd45e9a]193    # If updating from a local or very old version, use the default data.
194    if [ $REMOTE -eq 1 ] && which jq &>/dev/null && [ -f $INSTALL_TARGET/doc/VERSION.json ]; then
195        # Installed release.
196        read -pe INSTVERSION INSTRELEASE <<< $(jq -r '.version+" "+.release' $INSTALL_TARGET/doc/VERSION.json)
197        # Fetch tags (releases) data from GitHub.
198        while read -pe TAG URL; do
199            if [[ $TAG =~ ^opengnsys- ]]; then
200                [ "${TAG#opengnsys-}" \< "${INSTVERSION%pre}" ] && break
201                RELEASES+=( "${TAG}" )
202                DOWNLOADS+=( "$URL" )
203                #RELDATE=$(curl -s "$URL" | jq -r '.commit.committer.date | split("-") | join("")[:8]')
204            fi
205        done <<< $(curl -s "$API_URL/../../tags" | jq -r '.[] | .name+" "+.commit.url')
[66432fb]206        # Add development (master) branch.
207        RELEASES+=( "$BRANCH" )
208        DOWNLOADS+=( "$API_URL" )
[fd45e9a]209        # Show selection menu, if needed.
[ecdb637]210        if [ ${#RELEASES[@]} -gt 1 ]; then
[fd45e9a]211            echo "Installed version: $INSTVERSION $INSTRELEASE"
[66432fb]212            echo "Versions available for update (\"$BRANCH\" is the latest development branch):"
[fd45e9a]213            PS3="Enter a number: "
214            select opt in "${RELEASES[@]}"; do
215                if [ -n "$opt" ]; then
216                    BRANCH="$opt"
217                    API_URL="${DOWNLOADS[REPLY-1]}"
218                    break
219                fi
220            done
221        fi
222    fi
223    # Download URLs.
224    CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH"
225    RAW_URL="https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH"
226}
227
228
[64dd765]229# Comprobar auto-actualización.
230function checkAutoUpdate()
231{
232        local update=0
233
234        # Actaulizar el script si ha cambiado o no existe el original.
[884b6ce]235        if [ $REMOTE -eq 1 ]; then
236                curl -s $RAW_URL/installer/$PROGRAMNAME -o $PROGRAMNAME
[a3a1ff2]237                chmod +x $PROGRAMNAME
[d372e6e]238                if ! diff -q $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then
[64dd765]239                        mv $PROGRAMNAME $INSTALL_TARGET/lib
240                        update=1
241                else
242                        rm -f $PROGRAMNAME
243                fi
244        else
[d372e6e]245                if ! diff -q $PROGRAMDIR/$PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME 2>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then
[64dd765]246                        cp -a $PROGRAMDIR/$PROGRAMNAME $INSTALL_TARGET/lib
247                        update=1
248                fi
249        fi
250
251        return $update
252}
253
254
[a0867b37]255function getDateTime()
256{
[5eb61a6]257        date "+%Y%m%d-%H%M%S"
[a0867b37]258}
259
260# Escribe a fichero y muestra por pantalla
261function echoAndLog()
262{
[a3a1ff2]263        echo "$1"
[6ef01d9]264        DATETIME=`getDateTime`
265        echo "$DATETIME;$SSH_CLIENT;$1" >> $LOG_FILE
[a0867b37]266}
267
268function errorAndLog()
269{
[5eb61a6]270        echo "ERROR: $1"
271        DATETIME=`getDateTime`
[6ef01d9]272        echo "$DATETIME;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE
[a0867b37]273}
274
[cd86637]275# Escribe a fichero y muestra mensaje de aviso
276function warningAndLog()
277{
278        local DATETIME=`getDateTime`
279        echo "Warning: $1"
280        echo "$DATETIME;$SSH_CLIENT;Warning: $1" >> $LOG_FILE
281}
282
[a0867b37]283
284#####################################################################
285####### Funciones de copia de seguridad y restauración de ficheros
286#####################################################################
287
288# Hace un backup del fichero pasado por parámetro
289# deja un -last y uno para el día
290function backupFile()
291{
292        if [ $# -ne 1 ]; then
293                errorAndLog "${FUNCNAME}(): invalid number of parameters"
294                exit 1
295        fi
296
297        local fichero=$1
298        local fecha=`date +%Y%m%d`
299
300        if [ ! -f $fichero ]; then
[cd86637]301                warningAndLog "${FUNCNAME}(): file $fichero doesn't exists"
[a0867b37]302                return 1
303        fi
304
[ebbbfc01]305        echoAndLog "${FUNCNAME}(): Making $fichero back-up"
[a0867b37]306
307        # realiza una copia de la última configuración como last
[6ef01d9]308        cp -a $fichero "${fichero}-LAST"
[a0867b37]309
310        # si para el día no hay backup lo hace, sino no
311        if [ ! -f "${fichero}-${fecha}" ]; then
[6ef01d9]312                cp -a $fichero "${fichero}-${fecha}"
[a0867b37]313        fi
314}
315
316# Restaura un fichero desde su copia de seguridad
317function restoreFile()
318{
319        if [ $# -ne 1 ]; then
320                errorAndLog "${FUNCNAME}(): invalid number of parameters"
321                exit 1
322        fi
323
324        local fichero=$1
325
[ebbbfc01]326        echoAndLog "${FUNCNAME}(): restoring file $fichero"
[a0867b37]327        if [ -f "${fichero}-LAST" ]; then
[6ef01d9]328                cp -a "$fichero-LAST" "$fichero"
[a0867b37]329        fi
330}
331
332
333#####################################################################
[295b4ab]334####### Funciones de acceso a base de datos
335#####################################################################
336
337# Actualizar la base datos
338function importSqlFile()
339{
340        if [ $# -ne 4 ]; then
341                errorAndLog "${FNCNAME}(): invalid number of parameters"
342                exit 1
343        fi
344
345        local dbuser="$1"
346        local dbpassword="$2"
347        local database="$3"
348        local sqlfile="$4"
349        local tmpfile=$(mktemp)
[632bd45]350        local mycnf=/tmp/.my.cnf.$$
[295b4ab]351        local status
352
353        if [ ! -r $sqlfile ]; then
354                errorAndLog "${FUNCNAME}(): Unable to read $sqlfile!!"
355                return 1
356        fi
357
358        echoAndLog "${FUNCNAME}(): importing SQL file to ${database}..."
359        chmod 600 $tmpfile
360        sed -e "s/SERVERIP/$SERVERIP/g" -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \
[dde2db1]361            -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" $sqlfile > $tmpfile
[632bd45]362        # Componer fichero con credenciales de conexión. 
363        touch $mycnf
364        chmod 600 $mycnf
365        cat << EOT > $mycnf
[c073224]366[client]
[09bf701]367user=$dbuser
368password=$dbpassword
[632bd45]369EOT
[785085b]370        # Antes de actualizar, reasignar valores para campos no nulos con nulo por defecto.
371        mysql --defaults-extra-file=$MYCNF -D "$database" -e \
372                "$(mysql --defaults-extra-file=$MYCNF -Nse "
373SELECT CASE WHEN DATA_TYPE LIKE '%int' THEN
374                 CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT 0;')
375            WHEN DATA_TYPE LIKE '%char' THEN
376                 CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'ALTER', COLUMN_NAME, 'SET DEFAULT \'\';')
377            WHEN DATA_TYPE = 'text' THEN
378                 CONCAT_WS(' ', 'ALTER TABLE', TABLE_NAME, 'MODIFY', COLUMN_NAME, 'TEXT NOT NULL;')
379            ELSE ''
380       END
381  FROM information_schema.COLUMNS
382 WHERE TABLE_SCHEMA='$database'
383   AND IS_NULLABLE='NO'
384   AND COLUMN_DEFAULT IS NULL
385   AND COLUMN_KEY='';")"
[632bd45]386        # Ejecutar actualización y borrar fichero de credenciales.
[09bf701]387        mysql --defaults-extra-file=$mycnf --default-character-set=utf8 -D "$database" < $tmpfile
[295b4ab]388        status=$?
[632bd45]389        rm -f $mycnf $tmpfile
[295b4ab]390        if [ $status -ne 0 ]; then
391                errorAndLog "${FUNCNAME}(): error importing $sqlfile in database $database"
392                return 1
393        fi
394        echoAndLog "${FUNCNAME}(): file imported to database $database"
395        return 0
396}
397
[21372e8]398# Comprobar configuración de MySQL y recomendar cambios necesarios.
399function checkMysqlConfig()
400{
[0304465]401        echoAndLog "${FUNCNAME}(): checking MySQL configuration"
[3b0436d]402
403        cp -a $WORKDIR/opengnsys/server/etc/mysqld-og.cnf $MYSQLCFGDIR 2>/dev/null
404        service=$MYSQLSERV; $STARTSERVICE
[21372e8]405
406        echoAndLog "${FUNCNAME}(): MySQL configuration has checked"
407        return 0
408}
[295b4ab]409
410#####################################################################
[a0867b37]411####### Funciones de instalación de paquetes
412#####################################################################
413
414# Instalar las deependencias necesarias para el actualizador.
[64dd765]415function installDependencies()
[a0867b37]416{
[db9e706]417        local package
418
[a37e5fc4]419        # Comprobar si hay que actualizar PHP 5 a PHP 7.
420        eval $UPDATEPKGLIST
421        if [ -f /etc/debian_version ]; then
422                # Basado en paquetes Deb.
423                PHP7VERSION=$(apt-cache pkgnames php7 2>/dev/null | sort | head -1)
[ec536c6]424                PHPFPMSERV="${PHP7VERSION}-fpm"
425                PHP5PKGS=( $(dpkg -l | awk '$2~/^php5/ {print $2}') )
[a37e5fc4]426                if [ -n "$PHP5PKGS" ]; then
427                        $DELETEPKGS ${PHP5PKGS[@]}
[ec536c6]428                        PHP5PKGS[0]="$PHP7VERSION"
[a37e5fc4]429                        INSTALLDEPS=${PHP5PKGS[@]//php5*-/${PHP7VERSION}-}
430                fi
431        fi
[ec536c6]432        if [ "$OSDISTRIB" == "centos" ]; then
433                PHP7VERSION=$(yum list -q php7\* 2>/dev/null | awk -F. '/^php/ {print $1; exit;}')
[97b6579]434                PHPFPMSERV="${PHP7VERSION}-${PHPFPMSERV}"
[ec536c6]435                PHP5PKGS=( $(yum list installed | awk '$1~/^php/ && $2~/^5\./ {sub(/\..*$/, "", $1); print $1}') )
436                if [ -n "$PHP5PKGS" ]; then
437                        $DELETEPKGS ${PHP5PKGS[@]}
438                        PHP5PKGS[0]="$PHP7VERSION-php"
439                        INSTALLDEPS=${PHP5PKGS[@]//php-/${PHP7VERSION}-php}
440                fi
441        fi
[a37e5fc4]442
[a0867b37]443        if [ $# = 0 ]; then
[0304465]444                echoAndLog "${FUNCNAME}(): no dependencies are needed"
[c1e00e4]445        else
446                while [ $# -gt 0 ]; do
[a37e5fc4]447                        package="${1/php/$PHP7VERSION}"
[b6fd406]448                        eval $CHECKPKG || INSTALLDEPS="$INSTALLDEPS $package"
[c1e00e4]449                        shift
450                done
451                if [ -n "$INSTALLDEPS" ]; then
[db9e706]452                        $INSTALLPKGS $INSTALLDEPS
[c1e00e4]453                        if [ $? -ne 0 ]; then
[0304465]454                                errorAndLog "${FUNCNAME}(): cannot install some dependencies: $INSTALLDEPS"
[c1e00e4]455                                return 1
456                        fi
457                fi
458        fi
[a0867b37]459}
460
461
462#####################################################################
[884b6ce]463####### Funciones para descargar código
[a0867b37]464#####################################################################
465
[884b6ce]466function downloadCode()
[a0867b37]467{
468        if [ $# -ne 1 ]; then
469                errorAndLog "${FUNCNAME}(): invalid number of parameters"
470                exit 1
471        fi
472
[27dc5ff]473        local url="$1"
[a0867b37]474
[884b6ce]475        echoAndLog "${FUNCNAME}(): downloading code..."
[a0867b37]476
[4f64fa1]477        curl "$url" -o opengnsys.zip && \
478                unzip -qo opengnsys.zip && \
479                rm -fr opengnsys && \
480                mv "OpenGnsys-$BRANCH" opengnsys
[a0867b37]481        if [ $? -ne 0 ]; then
482                errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password"
483                return 1
484        fi
[884b6ce]485        rm -f opengnsys.zip
486        echoAndLog "${FUNCNAME}(): code was downloaded"
[a0867b37]487        return 0
488}
489
490
491############################################################
492###  Detectar red
493############################################################
494
[07c3a59]495# Comprobar si existe conexión.
496function checkNetworkConnection()
497{
[a0081b7]498        OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"opengnsys.es"}
[884b6ce]499        if which curl &>/dev/null; then
[506c670]500                curl --connect-timeout 10 -s "https://$OPENGNSYS_SERVER" -o /dev/null && \
501                        curl --connect-timeout 10 -s "http://$OPENGNSYS_SERVER" -o /dev/null
[884b6ce]502        elif which wget &>/dev/null; then
[506c670]503                wget --spider -q "https://$OPENGNSYS_SERVER" && \
504                        wget --spider -q "http://$OPENGNSYS_SERVER"
[884b6ce]505        else
506                echoAndLog "${FUNCNAME}(): Cannot execute \"wget\" nor \"curl\"."
507                return 1
508        fi
[07c3a59]509}
510
[0304465]511# Comprobar si la versión es anterior a la actual.
512function checkVersion()
513{
514        local PRE
515
516        # Obtener versión actual y versión a actualizar.
[9815cac]517        [ -f $INSTALL_TARGET/doc/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null)
518        [ -f $INSTALL_TARGET/doc/VERSION.json ] && OLDVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json 2>/dev/null)
[884b6ce]519        if [ $REMOTE -eq 1 ]; then
[9815cac]520                NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.json 2>/dev/null | jq -r '.version')
[0304465]521        else
[5f0c2dd]522                NEWVERSION=$(jq -r '.version' $PROGRAMDIR/../doc/VERSION.json 2>/dev/null)
[0304465]523        fi
524        [[ "$NEWVERSION" =~ pre ]] && PRE=1
525
526        # Comparar versiones.
527        [[ "$NEWVERSION" < "${OLDVERSION/pre/}" ]] && return 1
528        [ "${NEWVERSION/pre/}" == "$OLDVERSION" -a "$PRE" == "1" ] && return 1
529
530        return 0
531}
532
[739fb00]533# Obtener los parámetros de red del servidor.
534function getNetworkSettings()
535{
536        # Variables globales definidas:
537        # - SERVERIP:   IP local de la interfaz por defecto.
538
539        local DEVICES
540        local dev
541
[90b507d]542        SERVERIP="$ServidorAdm"
[739fb00]543        DEVICES="$(ip -o link show up | awk '!/loopback/ {sub(/:.*/,"",$2); print $2}')"
544        for dev in $DEVICES; do
[2c1b0cf]545                [ -z "$SERVERIP" ] && SERVERIP=$(ip -o addr show dev $dev | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4); exit;}')
[739fb00]546        done
547}
548
[a0867b37]549
550#####################################################################
551####### Funciones específicas de la instalación de Opengnsys
552#####################################################################
553
[5f21d34]554# Actualizar cliente OpenGnsys.
[295b4ab]555function updateClientFiles()
[45f1fe8]556{
[74cd321]557        local ENGINECFG=$INSTALL_TARGET/client/etc/engine.cfg
558
[a43e90d]559        # Actualizar ficheros del cliente.
[74cd321]560        backupFile $ENGINECFG
[0304465]561        echoAndLog "${FUNCNAME}(): Updating OpenGnsys Client files"
[884b6ce]562        rsync -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client
[45f1fe8]563        if [ $? -ne 0 ]; then
564                errorAndLog "${FUNCNAME}(): error while updating client structure"
[51b179a]565                exit 1
[45f1fe8]566        fi
[a43e90d]567
568        # Actualizar librerías del motor de clonación.
[0304465]569        echoAndLog "${FUNCNAME}(): Updating OpenGnsys Cloning Engine files"
[884b6ce]570        rsync -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin
[45f1fe8]571        if [ $? -ne 0 ]; then
572                errorAndLog "${FUNCNAME}(): error while updating engine files"
[51b179a]573                exit 1
[45f1fe8]574        fi
[a3855dc]575        # Actualizar fichero de configuración del motor de clonación.
[c40710e]576        if ! grep -q "^TZ" $ENGINECFG; then
[a3855dc]577                TZ=$(timedatectl status | awk -F"[:()]" '/Time.*zone/ {print $2}')
[c40710e]578                cat << EOT >> $ENGINECFG
[a3855dc]579# OpenGnsys Server timezone.
580TZ="${TZ// /}"
581EOT
582        fi
[8fc7ce1]583        if ! diff -q ${ENGINECFG}{,-LAST} &>/dev/null; then
[c40710e]584                NEWFILES="$NEWFILES $ENGINECFG"
585        else
586                rm -f ${ENGINECFG}-LAST
587        fi
[ec045b1]588        # Obtener URL para descargas adicionales.
589        DOWNLOADURL=$(oglivecli config download-url 2>/dev/null)
[a0081b7]590        DOWNLOADURL=${DOWNLOADURL:-"https://$OPENGNSYS_SERVER/trac/downloads"}
[a3855dc]591
[0304465]592        echoAndLog "${FUNCNAME}(): client files successfully updated"
[45f1fe8]593}
[4e51cb0]594
[5050850]595# Crear certificado para la firma de cargadores de arranque, si es necesario.
596function createCerts ()
597{
598        local SSLCFGDIR=$INSTALL_TARGET/client/etc/ssl
599        mkdir -p $SSLCFGDIR/{certs,private}
600        if [ ! -f $SSLCFGDIR/private/opengnsys.key ]; then
601                echoAndLog "${FUNCNAME}(): creating certificate files"
602                openssl req -new -x509 -newkey rsa:2048 -keyout $SSLCFGDIR/private/opengnsys.key -out $SSLCFGDIR/certs/opengnsys.crt -nodes -days 3650 -subj "/CN=OpenGnsys/"
603                openssl x509 -in $SSLCFGDIR/certs/opengnsys.crt -out $SSLCFGDIR/certs/opengnsys.cer -outform DER
604                echoAndLog "${FUNCNAME}(): certificate successfully created"
605        fi
606}
607
[3ce53a7]608# Configurar HTTPS y exportar usuario y grupo del servicio Apache.
609function apacheConfiguration ()
[4e51cb0]610{
[9215580]611        local config template module socketfile
[6f4d39b]612
[ec536c6]613        # Avtivar PHP-FPM.
614        echoAndLog "${FUNCNAME}(): configuring PHP-FPM"
615        service=$PHPFPMSERV
616        $ENABLESERVICE; $STARTSERVICE
617
[9215580]618        # Activar módulos de Apache.
[2e38f60]619        if [ -e $APACHECFGDIR/sites-available/opengnsys.conf ]; then
[0304465]620                echoAndLog "${FUNCNAME}(): Configuring Apache modules"
[3ce53a7]621                a2ensite default-ssl
[9215580]622                for module in $APACHEENABLEMODS; do a2enmod -q "$module"; done
623                for module in $APACHEDISABLEMODS; do a2dismod -q "${module//PHP7VERSION}"; done
[3ce53a7]624                a2ensite opengnsys
[5f21d34]625        elif [ -e $APACHECFGDIR/conf.modules.d ]; then
[0304465]626                echoAndLog "${FUNCNAME}(): Configuring Apache modules"
[5f21d34]627                sed -i '/rewrite/s/^#//' $APACHECFGDIR/*.conf
[3ce53a7]628        fi
[ec536c6]629        # Elegir plantilla según versión de Apache.
630        if [ -n "$(apachectl -v | grep "2\.[0-2]")" ]; then
631               template=$WORKDIR/opengnsys/server/etc/apache-prev2.4.conf.tmpl > $config
632        else
633               template=$WORKDIR/opengnsys/server/etc/apache.conf.tmpl
634        fi
[ea016a46]635        sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null | tail -1)
[6f4d39b]636        # Actualizar configuración de Apache a partir de fichero de plantilla.
637        for config in $APACHECFGDIR/{,sites-available/}opengnsys.conf; do
[37481d8]638                if [ -e $config ]; then
639                        if [ -n "$sockfile" ]; then
640                                sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g; s,proxy:fcgi:.*,proxy:unix:${sockfile%% *}|fcgi://localhost\",g" $template > $config
641                        else
642                                sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g" $template > $config
643                        fi
644                fi
[900be258]645        done
646
647        # Reiniciar Apache.
[ec536c6]648        service=$APACHESERV; $STARTSERVICE
[900be258]649
[3ce53a7]650        # Variables de ejecución de Apache.
[4e51cb0]651        # - APACHE_RUN_USER
652        # - APACHE_RUN_GROUP
[2e38f60]653        if [ -f $APACHECFGDIR/envvars ]; then
654                source $APACHECFGDIR/envvars
[4e51cb0]655        fi
[2e38f60]656        APACHE_RUN_USER=${APACHE_RUN_USER:-"$APACHEUSER"}
[de8bbb1]657        APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-"$APACHEGROUP"}
[4e51cb0]658}
659
[4b96166]660# Configurar servicio Rsync.
661function rsyncConfigure()
662{
663        local service
664
665        # Configurar acceso a Rsync.
666        if [ ! -f /etc/rsyncd.conf ]; then
[0304465]667                echoAndLog "${FUNCNAME}(): Configuring Rsync service"
[65baf16]668                NEWFILES="$NEWFILES /etc/rsyncd.conf"
[4b96166]669                sed -e "s/CLIENTUSER/$OPENGNSYS_CLIENTUSER/g" \
670                    $WORKDIR/opengnsys/repoman/etc/rsyncd.conf.tmpl > /etc/rsyncd.conf
671                # Habilitar Rsync.
672                if [ -f /etc/default/rsync ]; then
673                        perl -pi -e 's/RSYNC_ENABLE=.*/RSYNC_ENABLE=inetd/' /etc/default/rsync
674                fi
675                if [ -f $INETDCFGDIR/rsync ]; then
676                        perl -pi -e 's/disable.*/disable = no/' $INETDCFGDIR/rsync
677                else
678                        cat << EOT > $INETDCFGDIR/rsync
679service rsync
680{
681        disable = no
682        socket_type = stream
683        wait = no
684        user = root
685        server = $(which rsync)
686        server_args = --daemon
687        log_on_failure += USERID
688        flags = IPv6
689}
690EOT
691                fi
692                # Activar e iniciar Rsync.
693                service="rsync"  $ENABLESERVICE
[ab7f563]694                service="xinetd"
695                $ENABLESERVICE; $STARTSERVICE
[4b96166]696        fi
697}
698
[5f21d34]699# Copiar ficheros del OpenGnsys Web Console.
[a0867b37]700function updateWebFiles()
701{
[2b793a8]702        local ERRCODE COMPATDIR f
703
[a0867b37]704        echoAndLog "${FUNCNAME}(): Updating web files..."
[2b793a8]705
706        # Copiar los ficheros nuevos conservando el archivo de configuración de acceso.
707        backupFile $INSTALL_TARGET/www/controlacceso.php
708        mv $INSTALL_TARGET/www $INSTALL_TARGET/WebConsole
[884b6ce]709        rsync -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET
[2b793a8]710        ERRCODE=$?
711        mv $INSTALL_TARGET/WebConsole $INSTALL_TARGET/www
[1635f45]712        rm -fr $INSTALL_TARGET/www/xajax
[900be258]713        unzip -o $WORKDIR/opengnsys/admin/slim-2.6.1.zip -d $INSTALL_TARGET/www/rest
[8b8e948]714        unzip -o $WORKDIR/opengnsys/admin/swagger-ui-2.2.5.zip -d $INSTALL_TARGET/www/rest
[d655cc4]715        if [ $ERRCODE != 0 ]; then
[a0867b37]716                errorAndLog "${FUNCNAME}(): Error updating web files."
717                exit 1
718        fi
[2b793a8]719        restoreFile $INSTALL_TARGET/www/controlacceso.php
720
[1a2fa9d8]721        # Cambiar acceso a protocolo HTTPS.
722        if grep -q "http://" $INSTALL_TARGET/www/controlacceso.php 2>/dev/null; then
723                echoAndLog "${FUNCNAME}(): updating web access file"
724                perl -pi -e 's!http://!https://!g' $INSTALL_TARGET/www/controlacceso.php
725                NEWFILES="$NEWFILES $INSTALL_TARGET/www/controlacceso.php"
726        fi
727
[2b793a8]728        # Compatibilidad con dispositivos móviles.
729        COMPATDIR="$INSTALL_TARGET/www/principal"
730        for f in acciones administracion aula aulas hardwares imagenes menus repositorios softwares; do
731                sed 's/clickcontextualnodo/clicksupnodo/g' $COMPATDIR/$f.php > $COMPATDIR/$f.device.php
732        done
[d70a45f]733        cp -a $COMPATDIR/imagenes.device.php $COMPATDIR/imagenes.device4.php
[aafe8f9]734        # Acceso al manual de usuario
735        ln -fs ../doc/userManual $INSTALL_TARGET/www/userManual
[0645906]736        # Fichero de log de la API REST.
737        touch $INSTALL_TARGET/log/{ogagent,rest,remotepc}.log
[2b793a8]738
[0304465]739        echoAndLog "${FUNCNAME}(): Web files successfully updated"
[a0867b37]740}
741
[ec045b1]742# Copiar ficheros en la zona de descargas de OpenGnsys Web Console.
743function updateDownloadableFiles()
744{
[0304465]745        local FILENAME=ogagentpkgs-$NEWVERSION.tar.gz
[ec045b1]746        local TARGETFILE=$WORKDIR/$FILENAME
747
748        # Descargar archivo comprimido, si es necesario.
749        if [ -s $PROGRAMDIR/$FILENAME ]; then
750                echoAndLog "${FUNCNAME}(): Moving $PROGRAMDIR/$FILENAME file to $(dirname $TARGETFILE)"
751                mv $PROGRAMDIR/$FILENAME $TARGETFILE
752        else
753                echoAndLog "${FUNCNAME}(): Downloading $FILENAME"
[884b6ce]754                curl $DOWNLOADURL/$FILENAME -o $TARGETFILE
[ec045b1]755        fi
756        if [ ! -s $TARGETFILE ]; then
757                errorAndLog "${FUNCNAME}(): Cannot download $FILENAME"
758                return 1
759        fi
760
761        # Descomprimir fichero en zona de descargas.
762        tar xvzf $TARGETFILE -C $INSTALL_TARGET/www/descargas
763        if [ $? != 0 ]; then
[0304465]764                errorAndLog "${FUNCNAME}(): Error uncompressing archive $FILENAME"
[884b6ce]765                return 1
[ec045b1]766        fi
767}
768
[72134d5]769# Copiar carpeta de Interface
[64dd765]770function updateInterfaceAdm()
[72134d5]771{
[27dc5ff]772        local errcode=0
[2b793a8]773
[72134d5]774        # Crear carpeta y copiar Interface
775        echoAndLog "${FUNCNAME}(): Copying Administration Interface Folder"
776        mv $INSTALL_TARGET/client/interfaceAdm $INSTALL_TARGET/client/Interface
[884b6ce]777        rsync -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client
[27dc5ff]778        errcoce=$?
[72134d5]779        mv $INSTALL_TARGET/client/Interface $INSTALL_TARGET/client/interfaceAdm
[27dc5ff]780        if [ $errcode -ne 0 ]; then
[72134d5]781                echoAndLog "${FUNCNAME}(): error while updating admin interface"
782                exit 1
783        fi
[0304465]784        echoAndLog "${FUNCNAME}(): Admin interface successfully updated"
[72134d5]785}
[a0867b37]786
[5d6bf97]787# Crear documentación Doxygen para la consola web.
788function makeDoxygenFiles()
789{
790        echoAndLog "${FUNCNAME}(): Making Doxygen web files..."
791        $WORKDIR/opengnsys/installer/ogGenerateDoc.sh \
792                        $WORKDIR/opengnsys/client/engine $INSTALL_TARGET/www
793        if [ ! -d "$INSTALL_TARGET/www/html" ]; then
[0304465]794                errorAndLog "${FUNCNAME}(): unable to create Doxygen web files"
[5d6bf97]795                return 1
796        fi
[45f1fe8]797        rm -fr "$INSTALL_TARGET/www/api"
[15b2a4e]798        mv "$INSTALL_TARGET/www/html" "$INSTALL_TARGET/www/api"
799        rm -fr $INSTALL_TARGET/www/{man,perlmod,rtf}
[0304465]800        echoAndLog "${FUNCNAME}(): Doxygen web files created successfully"
[5d6bf97]801}
802
803
[a0867b37]804# Crea la estructura base de la instalación de opengnsys
805function createDirs()
806{
[eb9424f]807        # Crear estructura de directorios.
[a0867b37]808        echoAndLog "${FUNCNAME}(): creating directory paths in ${INSTALL_TARGET}"
[8cb279b]809        local dir MKNETDIR
[7bb72f7]810
[cfad47b]811        mkdir -p ${INSTALL_TARGET}/{bin,doc,etc,lib,sbin,www}
[d7ece95]812        mkdir -p ${INSTALL_TARGET}/{client,images/groups}
[a0867b37]813        mkdir -p ${INSTALL_TARGET}/log/clients
[eb9424f]814        ln -fs ${INSTALL_TARGET}/log /var/log/opengnsys
[7bb72f7]815        # Detectar directorio de instalación de TFTP.
816        if [ ! -L ${INSTALL_TARGET}/tftpboot ]; then
817                for dir in /var/lib/tftpboot /srv/tftp; do
818                        [ -d $dir ] && ln -fs $dir ${INSTALL_TARGET}/tftpboot
819                done
820        fi
[b4d8d51]821        mkdir -p $INSTALL_TARGET/tftpboot/{menu.lst,grub}/examples
[a0867b37]822        if [ $? -ne 0 ]; then
823                errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
824                return 1
825        fi
[663cd905]826        ! [ -f $INSTALL_TARGET/tftpboot/menu.lst/templates/00unknown ] && mv $INSTALL_TARGET/tftpboot/menu.lst/templates/* $INSTALL_TARGET/tftpboot/menu.lst/examples
[b4d8d51]827        ! [ -f $INSTALL_TARGET/tftpboot/grub/templates/10 ] && mv $INSTALL_TARGET/tftpboot/grub/templates/* $INSTALL_TARGET/tftpboot/grub/examples
[a0867b37]828
[8cb279b]829        # Preparar arranque en red con Grub.
830        for f in grub-mknetdir grub2-mknetdir; do
831                if which $f &>/dev/null; then MKNETDIR=$f; fi
832        done
[5969a13]833        $MKNETDIR --net-directory=${INSTALL_TARGET}/tftpboot --subdir=grub
[8cb279b]834
[eb9424f]835        # Crear usuario ficticio.
836        if id -u $OPENGNSYS_CLIENTUSER &>/dev/null; then
837                echoAndLog "${FUNCNAME}(): user \"$OPENGNSYS_CLIENTUSER\" is already created"
838        else
[5f21d34]839                echoAndLog "${FUNCNAME}(): creating OpenGnsys user"
[eb9424f]840                useradd $OPENGNSYS_CLIENTUSER 2>/dev/null
841                if [ $? -ne 0 ]; then
[5f21d34]842                        errorAndLog "${FUNCNAME}(): error creating OpenGnsys user"
[eb9424f]843                        return 1
844                fi
845        fi
846
[57f7e9c]847        # Mover el fichero de registro al directorio de logs.
848        echoAndLog "${FUNCNAME}(): moving update log file"
849        mv $LOG_FILE $OGLOGFILE && LOG_FILE=$OGLOGFILE
[7669bca]850        chmod 600 $LOG_FILE
[57f7e9c]851
[a0867b37]852        echoAndLog "${FUNCNAME}(): directory paths created"
853        return 0
854}
855
[566e84f]856# Actualización incremental de la BD (versión actaul a actaul+1, hasta final-1 a final).
857function updateDatabase()
858{
859        local DBDIR="$WORKDIR/opengnsys/admin/Database"
860        local file FILES=""
861
862        echoAndLog "${FUNCNAME}(): looking for database updates"
863        pushd $DBDIR >/dev/null
864        # Bucle de actualización incremental desde versión actual a la final.
865        for file in $OPENGNSYS_DATABASE-*-*.sql; do
866                case "$file" in
867                        $OPENGNSYS_DATABASE-$OLDVERSION-$NEWVERSION.sql)
868                                # Actualización única de versión inicial y final.
869                                FILES="$FILES $file"
870                                break
871                                ;;
872                        $OPENGNSYS_DATABASE-*-postinst.sql)
873                                # Ignorar fichero específico de post-instalación.
874                                ;;
875                        $OPENGNSYS_DATABASE-$OLDVERSION-*.sql)
876                                # Actualización de versión n a n+1.
877                                FILES="$FILES $file"
[b5db03a]878                                OLDVERSION="$(echo ${file%.*} | cut -f3 -d-)"
[566e84f]879                                ;;
880                        $OPENGNSYS_DATABASE-*-$NEWVERSION.sql)
881                                # Última actualización de versión final-1 a final.
882                                if [ -n "$FILES" ]; then
883                                        FILES="$FILES $file"
884                                        break
885                                fi
886                                ;;
887                esac
888        done
889        # Aplicar posible actualización propia para la versión final.
890        file=$OPENGNSYS_DATABASE-$NEWVERSION.sql
891        if [ -n "$FILES" -o "$OLDVERSION" = "$NEWVERSION" -a -r $file ]; then
892                FILES="$FILES $file"
893        fi
894
895        popd >/dev/null
896        if [ -n "$FILES" ]; then
897                for file in $FILES; do
[0cfe47a]898                        importSqlFile $OPENGNSYS_DBUSER $OPENGNSYS_DBPASSWORD $OPENGNSYS_DATABASE $DBDIR/$file
[566e84f]899                done
900                echoAndLog "${FUNCNAME}(): database is update"
901        else
902                echoAndLog "${FUNCNAME}(): database unchanged"
903        fi
904}
905
[a0867b37]906# Copia ficheros de configuración y ejecutables genéricos del servidor.
[64dd765]907function updateServerFiles()
[bb30a50]908{
[c1e00e4]909        # No copiar ficheros del antiguo cliente Initrd
[873cf1e]910        local SOURCES=( repoman/bin \
[c1e00e4]911                        server/bin \
[3e7d77b]912                        server/lib \
[42a0e41]913                        admin/Sources/Services/ogAdmServerAux \
914                        admin/Sources/Services/ogAdmRepoAux \
[873cf1e]915                        server/tftpboot \
[5969a13]916                        /usr/lib/shim/shimx64.efi.signed \
917                        /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed \
[bb30a50]918                        installer/opengnsys_uninstall.sh \
[6777e3e]919                        installer/opengnsys_export.sh \
920                        installer/opengnsys_import.sh \
[873cf1e]921                        doc )
922        local TARGETS=( bin \
923                        bin \
[3e7d77b]924                        lib \
[cdad332]925                        sbin/ogAdmServerAux \
926                        sbin/ogAdmRepoAux \
[873cf1e]927                        tftpboot \
[5969a13]928                        tftpboot/shimx64.efi.signed \
929                        tftpboot/grubx64.efi \
[9a2c0f9d]930                        lib/opengnsys_uninstall.sh \
[6777e3e]931                        lib/opengnsys_export.sh \
932                        lib/opengnsys_import.sh \
[873cf1e]933                        doc )
[a0867b37]934
935        if [ ${#SOURCES[@]} != ${#TARGETS[@]} ]; then
936                errorAndLog "${FUNCNAME}(): inconsistent number of array items"
937                exit 1
938        fi
939
940        echoAndLog "${FUNCNAME}(): updating files in server directories"
941        pushd $WORKDIR/opengnsys >/dev/null
942        local i
943        for (( i = 0; i < ${#SOURCES[@]}; i++ )); do
[27dc5ff]944                if [ -d "$INSTALL_TARGET/${TARGETS[i]}" ]; then
[884b6ce]945                        rsync -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}"))
[aa36857]946                else
[56f100f]947                        rsync -irplt "${SOURCES[i]}" $(readlink -m "$INSTALL_TARGET/${TARGETS[i]}")
[aa36857]948                fi
[a0867b37]949        done
950        popd >/dev/null
[df3cd7f]951        NEWFILES=""             # Ficheros de configuración que han cambiado de formato.
[f80f839]952        if grep -q 'pxelinux.0' /etc/dhcp*/dhcpd*.conf; then
[df3cd7f]953                echoAndLog "${FUNCNAME}(): updating DHCP files"
[f80f839]954                perl -pi -e 's/pxelinux.0/grldr/' /etc/dhcp*/dhcpd*.conf
[a37e5fc4]955                service=$DHCPSERV; $STARTSERVICE
[df3cd7f]956                NEWFILES="/etc/dhcp*/dhcpd*.conf"
957        fi
[5969a13]958        if ! grep -q 'shimx64.efi.signed' /etc/dhcp*/dhcpd*.conf; then
959                echoAndLog "${FUNCNAME}(): updating DHCP files for UEFI computers"
960                UEFICFG="    # 0007 == x64 EFI boot\n"\
961"    if option arch = 00:07 {\n"\
962"        filename \"shimx64.efi.signed\";\n"\
963"    } else {\n"\
964"        filename \"grldr\";\n"\
965"    }"
[8f24716]966                sed -i -e 1i"option arch code 93 = unsigned integer 16;" -e s@"^.*grldr\"\;"@"$UEFICFG"@g /etc/dhcp*/dhcpd*.conf
[5969a13]967                service=$DHCPSERV; $STARTSERVICE
968                NEWFILES="/etc/dhcp*/dhcpd*.conf"
969        fi
[d372e6e]970        if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys 2>/dev/null; then
[df3cd7f]971                echoAndLog "${FUNCNAME}(): updating new init file"
972                backupFile /etc/init.d/opengnsys
[4816ea5]973                service="opengnsys"
974                $STOPSERVICE
[df3cd7f]975                cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys
[4816ea5]976                systemctl daemon-reload
977                $STARTSERVICE
[df3cd7f]978                NEWFILES="$NEWFILES /etc/init.d/opengnsys"
979        fi
[3b8ef0d]980        if ! diff -q $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default /etc/default/opengnsys >/dev/null; then
981                echoAndLog "${FUNCNAME}(): updating new default file"
982                backupFile /etc/default/opengnsys
983                # Buscar si hay nuevos parámetros.
984                local var valor
985                while IFS="=" read -e var valor; do
986                        [[ $var =~ ^# ]] || \
987                                grep -q "^$var=" /etc/default/opengnsys || \
988                                echo "$var=$valor" >> /etc/default/opengnsys
989                done < $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.default
990                NEWFILES="$NEWFILES /etc/default/opengnsys"
991        fi
[1a2fa9d8]992        if egrep -q "(UrlMsg=.*msgbrowser.php)|(UrlMenu=http://)" $INSTALL_TARGET/client/etc/ogAdmClient.cfg 2>/dev/null; then
[df3cd7f]993                echoAndLog "${FUNCNAME}(): updating new client config file"
994                backupFile $INSTALL_TARGET/client/etc/ogAdmClient.cfg
[1a2fa9d8]995                perl -pi -e 's!UrlMsg=.*msgbrowser\.php!UrlMsg=http://localhost/cgi-bin/httpd-log\.sh!g; s!UrlMenu=http://!UrlMenu=https://!g' $INSTALL_TARGET/client/etc/ogAdmClient.cfg
[df3cd7f]996                NEWFILES="$NEWFILES $INSTALL_TARGET/client/etc/ogAdmClient.cfg"
[f80f839]997        fi
[a3855dc]998
[9ee62ad]999        echoAndLog "${FUNCNAME}(): updating cron files"
[db9e706]1000        [ ! -f /etc/cron.d/torrentcreator ] && echo "* * * * *   root   [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator
1001        [ ! -f /etc/cron.d/torrenttracker ] && echo "5 * * * *   root   [ -x $INSTALL_TARGET/bin/torrent-tracker ] && $INSTALL_TARGET/bin/torrent-tracker" > /etc/cron.d/torrenttracker
[dc762088]1002        [ ! -f /etc/cron.d/imagedelete ] && echo "* * * * *   root   [ -x $INSTALL_TARGET/bin/deletepreimage ] && $INSTALL_TARGET/bin/deletepreimage" > /etc/cron.d/imagedelete
[0645906]1003        [ ! -f /etc/cron.d/ogagentqueue ] && echo "* * * * *   root   [ -x $INSTALL_TARGET/bin/ogagentqueue.cron ] && $INSTALL_TARGET/bin/ogagentqueue.cron" > /etc/cron.d/ogagentqueue
[b4d8d51]1004
[d9b2413]1005        echoAndLog "${FUNCNAME}(): deleting deprecated cron file"
1006        [ -e /etc/cron.d/opengnsys ] && rm -f /etc/cron.d/opengnsys \
1007                                              $INSTALL_TARGET/bin/opengnsys.cron
1008
[b4d8d51]1009        # Se modifican los nombres de las plantilla PXE por compatibilidad con los equipos UEFI.
1010        if [ -f $INSTALL_TARGET/tftpboot/menu.lst/templates/01 ]; then
1011            BIOSPXEDIR="$INSTALL_TARGET/tftpboot/menu.lst/templates"
1012            mv $BIOSPXEDIR/01 $BIOSPXEDIR/10
[74e6712]1013            sed -i "s/\bMBR\b/1hd/" $BIOSPXEDIR/10
[b4d8d51]1014        fi
[8f24716]1015        echoAndLog "${FUNCNAME}(): server files successfully updated"
[a0867b37]1016}
1017
1018####################################################################
1019### Funciones de compilación de código fuente de servicios
1020####################################################################
1021
[dde65c7]1022# Mueve el fichero del nuevo servicio si es distinto al del directorio destino.
1023function moveNewService()
1024{
1025        local service
1026
1027        # Recibe 2 parámetros: fichero origen y directorio destino.
1028        [ $# == 2 ] || return 1
[ddcb0cf]1029        [ -f  $1 -a -d $2 ] || return 1
[dde65c7]1030
1031        # Comparar los ficheros.
[ddcb0cf]1032        if ! diff -q $1 $2/$(basename $1) &>/dev/null; then
[dde65c7]1033                # Parar los servicios si fuese necesario.
[646ef92]1034                service="opengnsys"
1035                [ -z "$NEWSERVICES" ] && $STOPSERVICE
[dde65c7]1036                # Nuevo servicio.
1037                NEWSERVICES="$NEWSERVICES $(basename $1)"
1038                # Mover el nuevo fichero de servicio
1039                mv $1 $2
[646ef92]1040                $STARTSERVICE
[dde65c7]1041        fi
1042}
1043
1044
[bb30a50]1045# Recompilar y actualiza los serivicios y clientes.
[64dd765]1046function compileServices()
[a0867b37]1047{
[bb30a50]1048        local hayErrores=0
1049
[5f21d34]1050        # Compilar OpenGnsys Server
1051        echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Admin Server"
[bb30a50]1052        pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer
[7e5e25e]1053        autoreconf -fi && ./configure && make && moveNewService ogAdmServer $INSTALL_TARGET/sbin
[bb30a50]1054        if [ $? -ne 0 ]; then
[5f21d34]1055                echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Admin Server"
[bb30a50]1056                hayErrores=1
1057        fi
1058        popd
[dde2db1]1059        # Parar antiguo servicio de repositorio.
[b351d8a]1060        pgrep ogAdmRepo > /dev/null && service="ogAdmRepo" $STOPSERVICE
[4816ea5]1061        # Remove OpenGnsys Agent (ogAdmAgent)
1062        echoAndLog "${FUNCNAME}(): deleting deprecated OpenGnsys Agent"
1063        [ -e $INSTALL_TARGET/sbin/ogAdmAgent ] && \
1064                rm -f $INSTALL_TARGET/sbin/ogAdmAgent
[bb30a50]1065
[5f21d34]1066        # Compilar OpenGnsys Client
1067        echoAndLog "${FUNCNAME}(): Recompiling OpenGnsys Client"
[72134d5]1068        pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient
[e473667]1069        make && mv ogAdmClient $INSTALL_TARGET/client/bin
[a0867b37]1070        if [ $? -ne 0 ]; then
[5f21d34]1071                echoAndLog "${FUNCNAME}(): error while compiling OpenGnsys Client"
[a0867b37]1072                hayErrores=1
1073        fi
1074        popd
[8f24716]1075        # Generar un API token de ogAdmServer si no existe en el fichero de configuración.
1076        grep -q "APITOKEN=" $INSTALL_TARGET/etc/ogAdmServer.cfg || \
[35f1277]1077                $INSTALL_TARGET/bin/settoken -f
[a0867b37]1078
1079        return $hayErrores
1080}
1081
1082
1083####################################################################
[5f21d34]1084### Funciones instalacion cliente OpenGnsys
[a0867b37]1085####################################################################
1086
[5f21d34]1087# Actualizar cliente OpenGnsys
[c1e00e4]1088function updateClient()
1089{
[66b04ff]1090        #local FILENAME=ogLive-precise-3.2.0-23-generic-r5159.iso       # 1.1.0-rc6 (32-bit)
[2e1b900]1091        local FILENAME=ogLive-bionic-5.0.0-27-generic-amd64-r20190830.7208cc9.iso       # 1.1.1-rc5
[0b85cc93]1092        local SOURCEFILE=$DOWNLOADURL/$FILENAME
[0496417]1093        local TARGETFILE=$(oglivecli config download-dir)/$FILENAME
[0b85cc93]1094        local SOURCELENGTH
1095        local TARGETLENGTH
[0496417]1096        local OGINITRD
[a63345ac]1097        local SAMBAPASS
[0b85cc93]1098
[0496417]1099        # Comprobar si debe convertirse el antiguo cliente al nuevo formato ogLive.
1100        if oglivecli check | grep -q "oglivecli convert"; then
1101                echoAndLog "${FUNCNAME}(): Converting OpenGnsys Client to default ogLive"
1102                oglivecli convert
1103        fi
[0b85cc93]1104        # Comprobar si debe actualizarse el cliente.
[5f0c2dd]1105        SOURCELENGTH=$(curl -sI $SOURCEFILE 2>&1 | awk '/Content-Length:/ {gsub("\r", ""); print $2}')
[0496417]1106        TARGETLENGTH=$(stat -c "%s" $TARGETFILE 2>/dev/null)
[d4e90c1]1107        [ -z $TARGETLENGTH ] && TARGETLENGTH=0
[0b85cc93]1108        if [ "$SOURCELENGTH" != "$TARGETLENGTH" ]; then
[ec045b1]1109                echoAndLog "${FUNCNAME}(): Downloading $FILENAME"
[0496417]1110                oglivecli download $FILENAME
[0b85cc93]1111                if [ ! -s $TARGETFILE ]; then
[ec045b1]1112                        errorAndLog "${FUNCNAME}(): Error downloading $FILENAME"
[0b85cc93]1113                        return 1
1114                fi
[1893b9d]1115                # Actaulizar la imagen ISO del ogclient.
[0304465]1116                echoAndLog "${FUNCNAME}(): Updatting ogLive client"
[0496417]1117                oglivecli install $FILENAME
[e1c01217]1118               
[2e1b900]1119                INSTALLEDOGLIVE=${FILENAME%.*}
[ee4beb4]1120
[0304465]1121                echoAndLog "${FUNCNAME}(): ogLive successfully updated"
[0b85cc93]1122        else
[65baf16]1123                # Si no existe, crear el fichero de claves de Rsync.
1124                if [ ! -f /etc/rsyncd.secrets ]; then
[ec045b1]1125                        echoAndLog "${FUNCNAME}(): Restoring ogLive access key"
[0496417]1126                        OGINITRD=$(oglivecli config install-dir)/$(jq -r ".oglive[.default].directory")/oginitrd.img
[65baf16]1127                        SAMBAPASS=$(gzip -dc $OGINITRD | \
1128                                    cpio -i --to-stdout scripts/ogfunctions 2>&1 | \
1129                                    grep "^[    ].*OPTIONS=" | \
1130                                    sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/')
[0496417]1131                        echo -ne "$SAMBAPASS\n$SAMBAPASS\n" | setsmbpass
[65baf16]1132                else
[ec045b1]1133                        echoAndLog "${FUNCNAME}(): ogLive is already updated"
[65baf16]1134                fi
[04e5d96]1135                # Versión del ogLive instalado.
1136                echo "${FILENAME%.*}" > $INSTALL_TARGET/doc/veroglive.txt
[c1e00e4]1137        fi
1138}
[a0867b37]1139
[5b95ab6]1140# Comprobar permisos y ficheros.
1141function checkFiles()
1142{
[fbc7333]1143        local LOGROTATEDIR=/etc/logrotate.d
1144
[5b95ab6]1145        # Comprobar permisos adecuados.
1146        if [ -x $INSTALL_TARGET/bin/checkperms ]; then
[0304465]1147                echoAndLog "${FUNCNAME}(): Checking permissions"
[5b95ab6]1148                OPENGNSYS_DIR="$INSTALL_TARGET" OPENGNSYS_USER="$OPENGNSYS_CLIENTUSER" APACHE_USER="$APACHE_RUN_USER" APACHE_GROUP="$APACHE_RUN_GROUP" $INSTALL_TARGET/bin/checkperms
1149        fi
1150        # Eliminamos el fichero de estado del tracker porque es incompatible entre los distintos paquetes
1151        if [ -f /tmp/dstate ]; then
[0304465]1152                echoAndLog "${FUNCNAME}(): Deleting unused files"
[5b95ab6]1153                rm -f /tmp/dstate
1154        fi
[59d6670]1155        # Crear nuevos ficheros de logrotate y borrar el fichero antiguo.
[fbc7333]1156        if [ -d $LOGROTATEDIR ]; then
[59d6670]1157                rm -f $LOGROTATEDIR/opengnsys
[fbc7333]1158                if [ ! -f $LOGROTATEDIR/opengnsysServer ]; then
1159                        echoAndLog "${FUNCNAME}(): Creating logrotate configuration file for server"
1160                        sed -e "s/OPENGNSYSDIR/${INSTALL_TARGET//\//\\/}/g" \
1161                                $WORKDIR/opengnsys/server/etc/logrotate.tmpl > $LOGROTATEDIR/opengnsysServer
1162                fi
1163                if [ ! -f $LOGROTATEDIR/opengnsysRepo ]; then
1164                        echoAndLog "${FUNCNAME}(): Creating logrotate configuration file for repository"
1165                        sed -e "s/OPENGNSYSDIR/${INSTALL_TARGET//\//\\/}/g" \
1166                                $WORKDIR/opengnsys/server/etc/logrotate.tmpl > $LOGROTATEDIR/opengnsysRepo
1167                fi
1168        fi
[5b95ab6]1169}
1170
[eb9424f]1171# Resumen de actualización.
1172function updateSummary()
1173{
1174        # Actualizar fichero de versión y revisión.
[884b6ce]1175        local VERSIONFILE REVISION
[3bbaf79]1176        VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json"
[5f0c2dd]1177        # Obtener revisión.
1178        if [ $REMOTE -eq 1 ]; then
1179                # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit).
[663363a]1180                if [ "$BRANCH" = "master" ]; then
1181                        REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | split("-") | join("")[:8]) + "." + (.commit.sha[:7])')
1182                else
1183                        REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.committer.date | split("-") | join("")[:8]) + "." + (.sha[:7])')
1184                fi
[5f0c2dd]1185        else
1186                # Parámetro "release" del fichero JSON.
1187                REVISION=$(jq -r '.release' $PROGRAMDIR/../doc/VERSION.json 2>/dev/null)
1188        fi
[3bbaf79]1189        [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' > $VERSIONFILE
1190        jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE
1191        VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)"
1192        # Borrar antiguo fichero de versión.
1193        rm -f "${VERSIONFILE/json/txt}"
[eb9424f]1194
1195        echo
[5f21d34]1196        echoAndLog "OpenGnsys Update Summary"
[df3cd7f]1197        echo       "========================"
[3bbaf79]1198        echoAndLog "Project version:                  $VERSION"
[57f7e9c]1199        echoAndLog "Update log file:                  $LOG_FILE"
[c3e4ff1]1200        [ "$NEWFILES" ] && echoAndLog "Check new config files:           $(echo $NEWFILES)"
1201        [ "$NEWSERVICES" ] && echoAndLog "New compiled services:            $(echo $NEWSERVICES)"
[8b2da718]1202        echoAndLog "Warnings:"
[0304465]1203        echoAndLog " - You must to clear web browser cache before loading OpenGnsys page"
[dde2db1]1204        echoAndLog " - Run \"settoken\" script to update authentication tokens"
[c3e4ff1]1205        [ "$INSTALLEDOGLIVE" ] && echoAndLog " - Installed new ogLive Client: $INSTALLEDOGLIVE"
[ce63f8d]1206        echoAndLog " - If you want to use BURG as boot manager, run following command as root:"
1207        echoAndLog "      curl $DOWNLOADURL/burg.tgz -o $INSTALL_TARGET/client/lib/burg.tgz"
1208
[eb9424f]1209        echo
1210}
1211
1212
[a0867b37]1213
1214#####################################################################
[5f21d34]1215####### Proceso de actualización de OpenGnsys
[a0867b37]1216#####################################################################
1217
1218
[27dc5ff]1219# Comprobar si hay conexión y detectar parámetros de red por defecto.
1220checkNetworkConnection
1221if [ $? -ne 0 ]; then
1222        errorAndLog "Error connecting to server. Causes:"
[0304465]1223        errorAndLog " - Network is unreachable, check device parameters"
1224        errorAndLog " - You are inside a private network, configure the proxy service"
1225        errorAndLog " - Server is temporally down, try again later"
[27dc5ff]1226        exit 1
1227fi
[739fb00]1228getNetworkSettings
[27dc5ff]1229
[fd45e9a]1230# Elegir versión y comprobar si se intanta actualizar a una versión anterior.
1231chooseVersion
[0304465]1232checkVersion
1233if [ $? -ne 0 ]; then
1234        errorAndLog "Cannot downgrade to an older version ($OLDVERSION to $NEWVERSION)"
1235        errorAndLog "You must to uninstall OpenGnsys and install desired release"
1236        exit 1
1237fi
1238
[663363a]1239echoAndLog "OpenGnsys update begins at $(date)"
1240pushd $WORKDIR
1241
[64dd765]1242# Comprobar auto-actualización del programa.
1243if [ "$PROGRAMDIR" != "$INSTALL_TARGET/bin" ]; then
1244        checkAutoUpdate
1245        if [ $? -ne 0 ]; then
[0304465]1246                echoAndLog "OpenGnsys updater has been overwritten"
[063caa5]1247                echoAndLog "Please, run this script again"
[64dd765]1248                exit
1249        fi
1250fi
1251
[db9e706]1252# Detectar datos de auto-configuración del instalador.
1253autoConfigure
1254
[bb30a50]1255# Instalar dependencias.
[d70a45f]1256installDependencies ${DEPENDENCIES[*]}
[a0867b37]1257if [ $? -ne 0 ]; then
[0304465]1258        errorAndLog "Error: you must to install all needed dependencies"
[a0867b37]1259        exit 1
1260fi
1261
[5f21d34]1262# Arbol de directorios de OpenGnsys.
[a0867b37]1263createDirs ${INSTALL_TARGET}
1264if [ $? -ne 0 ]; then
[0304465]1265        errorAndLog "Error while creating directory paths"
[a0867b37]1266        exit 1
1267fi
1268
1269# Si es necesario, descarga el repositorio de código en directorio temporal
[884b6ce]1270if [ $REMOTE -eq 1 ]; then
1271        downloadCode $CODE_URL
[a0867b37]1272        if [ $? -ne 0 ]; then
[884b6ce]1273                errorAndLog "Error while getting code from repository"
[a0867b37]1274                exit 1
1275        fi
1276else
1277        ln -fs "$(dirname $PROGRAMDIR)" opengnsys
1278fi
1279
[21372e8]1280# Comprobar configuración de MySQL.
1281checkMysqlConfig $OPENGNSYS_DBUSER $OPENGNSYS_DBPASSWORD
1282
[566e84f]1283# Actualizar la BD.
1284updateDatabase
[295b4ab]1285
1286# Actualizar ficheros complementarios del servidor
[a0867b37]1287updateServerFiles
1288if [ $? -ne 0 ]; then
[5f21d34]1289        errorAndLog "Error updating OpenGnsys Server files"
[a0867b37]1290        exit 1
1291fi
1292
[be49575]1293# Configurar Rsync.
1294rsyncConfigure
1295
[5050850]1296# Actualizar ficheros del cliente.
[295b4ab]1297updateClientFiles
[5050850]1298createCerts
[295b4ab]1299updateInterfaceAdm
[45f1fe8]1300
[5050850]1301# Actualizar páqinas web.
[3ce53a7]1302apacheConfiguration
[a0867b37]1303updateWebFiles
1304if [ $? -ne 0 ]; then
[5f21d34]1305        errorAndLog "Error updating OpenGnsys Web Admin files"
[a0867b37]1306        exit 1
1307fi
[ec045b1]1308# Actaulizar ficheros descargables.
1309updateDownloadableFiles
[5d6bf97]1310# Generar páginas Doxygen para instalar en el web
1311makeDoxygenFiles
[a0867b37]1312
[bb30a50]1313# Recompilar y actualizar los servicios del sistema
[c3e4ff1]1314if compileServices; then
1315        # Restart services, if necessary.
1316        if [ "$NEWSERVICES" ]; then
1317                echoAndLog "Restarting OpenGnsys services"
1318                service="opengnsys" $STARTSERVICE
1319        fi
1320else
1321        errorAndLog "Error compiling OpenGnsys services"
1322        exit 1
1323fi
[bb30a50]1324
1325# Actaulizar ficheros auxiliares del cliente
[a0867b37]1326updateClient
1327if [ $? -ne 0 ]; then
[0304465]1328        errorAndLog "Error updating client files"
[a0867b37]1329        exit 1
1330fi
1331
[5b95ab6]1332# Comprobar permisos y ficheros.
1333checkFiles
[3320409]1334
[eb9424f]1335# Mostrar resumen de actualización.
1336updateSummary
1337
[3b8ef0d]1338rm -rf $WORKDIR
[5f21d34]1339echoAndLog "OpenGnsys update finished at $(date)"
[a0867b37]1340
1341popd
1342
Note: See TracBrowser for help on using the repository browser.