[a0867b37] | 1 | #!/bin/bash |
---|
| 2 | #/** |
---|
| 3 | #@file opengnsys_update.sh |
---|
| 4 | #@brief Script actualización de OpenGnSys |
---|
| 5 | #@warning No se actualiza BD, ni ficheros de configuración. |
---|
| 6 | #@version 0.9 - basado en opengnsys_installer.sh |
---|
| 7 | #@author Ramón Gómez - ETSII Univ. Sevilla |
---|
| 8 | #@date 2010/01/27 |
---|
[c1e00e4] | 9 | #@version 1.0 - adaptación a OpenGnSys 1.0 |
---|
| 10 | #@author Ramón Gómez - ETSII Univ. Sevilla |
---|
| 11 | #@date 2011/03/02 |
---|
[64dd765] | 12 | #@version 1.0.1 - control de auto actualización del script |
---|
| 13 | #@author Ramón Gómez - ETSII Univ. Sevilla |
---|
| 14 | #@date 2011/05/17 |
---|
[739fb00] | 15 | #@version 1.0.2a - obtiene valor de dirección IP por defecto |
---|
| 16 | #@author Ramón Gómez - ETSII Univ. Sevilla |
---|
| 17 | #@date 2012/01/18 |
---|
[1175096] | 18 | #@version 1.0.3 - Compatibilidad con Debian y auto configuración de acceso a BD. |
---|
[7bb72f7] | 19 | #@author Ramón Gómez - ETSII Univ. Sevilla |
---|
[1175096] | 20 | #@date 2012/03/12 |
---|
[a0867b37] | 21 | #*/ |
---|
| 22 | |
---|
| 23 | |
---|
[1175096] | 24 | #### AVISO: NO EDITAR variables de configuración. |
---|
| 25 | #### WARNING: DO NOT EDIT configuration variables. |
---|
| 26 | INSTALL_TARGET=/opt/opengnsys # Directorio de instalación |
---|
[295b4ab] | 27 | OPENGNSYS_CLIENTUSER="opengnsys" # Usuario Samba |
---|
| 28 | |
---|
| 29 | |
---|
[a0867b37] | 30 | # Sólo ejecutable por usuario root |
---|
[6ef01d9] | 31 | if [ "$(whoami)" != 'root' ]; then |
---|
[a0867b37] | 32 | echo "ERROR: this program must run under root privileges!!" |
---|
| 33 | exit 1 |
---|
| 34 | fi |
---|
[4e51cb0] | 35 | # Error si OpenGnSys no está instalado (no existe el directorio del proyecto) |
---|
| 36 | if [ ! -d $INSTALL_TARGET ]; then |
---|
| 37 | echo "ERROR: OpenGnSys is not installed, cannot update!!" |
---|
| 38 | exit 1 |
---|
| 39 | fi |
---|
[1175096] | 40 | # Cargar configuración de acceso a la base de datos. |
---|
| 41 | if [ -r $INSTALL_TARGET/etc/ogAdmServer.cfg ]; then |
---|
| 42 | source $INSTALL_TARGET/etc/ogAdmServer.cfg |
---|
| 43 | elif [ -r $INSTALL_TARGET/etc/ogAdmAgent.cfg ]; then |
---|
| 44 | source $INSTALL_TARGET/etc/ogAdmAgent.cfg |
---|
| 45 | fi |
---|
| 46 | OPENGNSYS_DATABASE=${OPENGNSYS_DATABASE:-"$CATALOG"} # Base datos |
---|
| 47 | OPENGNSYS_DBUSER=${OPENGNSYS_DBUSER:-"$USUARIO"} # Usuario de acceso |
---|
| 48 | OPENGNSYS_DBPASSWORD=${OPENGNSYS_DBPASSWORD:-"$PASSWORD"} # Clave del usuario |
---|
| 49 | if [ -z "$OPENGNSYS_DATABASE" -o -z "$OPENGNSYS_DBUSER" -o -z "$OPENGNSYS_DBPASSWORD" ]; then |
---|
| 50 | echo "ERROR: set OPENGNSYS_DATABASE, OPENGNSYS_DBUSER and OPENGNSYS_DBPASSWORD" |
---|
| 51 | echo " variables, and run this script again." |
---|
| 52 | fi |
---|
[a0867b37] | 53 | |
---|
| 54 | # Comprobar si se ha descargado el paquete comprimido (USESVN=0) o sólo el instalador (USESVN=1). |
---|
| 55 | PROGRAMDIR=$(readlink -e $(dirname "$0")) |
---|
[64dd765] | 56 | PROGRAMNAME=$(basename "$0") |
---|
[c1e00e4] | 57 | DEPS="build-essential g++-multilib rsync ctorrent samba unzip netpipes debootstrap schroot squashfs-tools" |
---|
[07c3a59] | 58 | OPENGNSYS_SERVER="www.opengnsys.es" |
---|
[a0867b37] | 59 | if [ -d "$PROGRAMDIR/../installer" ]; then |
---|
[6ef01d9] | 60 | USESVN=0 |
---|
[a0867b37] | 61 | else |
---|
[6ef01d9] | 62 | USESVN=1 |
---|
| 63 | DEPS="$DEPS subversion" |
---|
[a0867b37] | 64 | fi |
---|
[eb9424f] | 65 | SVN_URL="http://$OPENGNSYS_SERVER/svn/branches/version1.0/" |
---|
[a0867b37] | 66 | |
---|
| 67 | WORKDIR=/tmp/opengnsys_update |
---|
| 68 | mkdir -p $WORKDIR |
---|
| 69 | |
---|
| 70 | LOG_FILE=/tmp/opengnsys_update.log |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | ##################################################################### |
---|
| 75 | ####### Algunas funciones útiles de propósito general: |
---|
| 76 | ##################################################################### |
---|
[295b4ab] | 77 | |
---|
[64dd765] | 78 | # Comprobar auto-actualización. |
---|
| 79 | function checkAutoUpdate() |
---|
| 80 | { |
---|
| 81 | local update=0 |
---|
| 82 | |
---|
| 83 | # Actaulizar el script si ha cambiado o no existe el original. |
---|
| 84 | if [ $USESVN -eq 1 ]; then |
---|
[7b0c6ff] | 85 | svn export $SVN_URL/installer/$PROGRAMNAME |
---|
[64dd765] | 86 | if ! diff --brief $PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME &>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then |
---|
| 87 | mv $PROGRAMNAME $INSTALL_TARGET/lib |
---|
| 88 | update=1 |
---|
| 89 | else |
---|
| 90 | rm -f $PROGRAMNAME |
---|
| 91 | fi |
---|
| 92 | else |
---|
| 93 | if ! diff --brief $PROGRAMDIR/$PROGRAMNAME $INSTALL_TARGET/lib/$PROGRAMNAME &>/dev/null || ! test -f $INSTALL_TARGET/lib/$PROGRAMNAME; then |
---|
| 94 | cp -a $PROGRAMDIR/$PROGRAMNAME $INSTALL_TARGET/lib |
---|
| 95 | update=1 |
---|
| 96 | fi |
---|
| 97 | fi |
---|
| 98 | |
---|
| 99 | return $update |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | |
---|
[a0867b37] | 103 | function getDateTime() |
---|
| 104 | { |
---|
[5eb61a6] | 105 | date "+%Y%m%d-%H%M%S" |
---|
[a0867b37] | 106 | } |
---|
| 107 | |
---|
| 108 | # Escribe a fichero y muestra por pantalla |
---|
| 109 | function echoAndLog() |
---|
| 110 | { |
---|
[5eb61a6] | 111 | echo $1 |
---|
[6ef01d9] | 112 | DATETIME=`getDateTime` |
---|
| 113 | echo "$DATETIME;$SSH_CLIENT;$1" >> $LOG_FILE |
---|
[a0867b37] | 114 | } |
---|
| 115 | |
---|
| 116 | function errorAndLog() |
---|
| 117 | { |
---|
[5eb61a6] | 118 | echo "ERROR: $1" |
---|
| 119 | DATETIME=`getDateTime` |
---|
[6ef01d9] | 120 | echo "$DATETIME;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE |
---|
[a0867b37] | 121 | } |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | ##################################################################### |
---|
| 125 | ####### Funciones de copia de seguridad y restauración de ficheros |
---|
| 126 | ##################################################################### |
---|
| 127 | |
---|
| 128 | # Hace un backup del fichero pasado por parámetro |
---|
| 129 | # deja un -last y uno para el día |
---|
| 130 | function backupFile() |
---|
| 131 | { |
---|
| 132 | if [ $# -ne 1 ]; then |
---|
| 133 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
| 134 | exit 1 |
---|
| 135 | fi |
---|
| 136 | |
---|
| 137 | local fichero=$1 |
---|
| 138 | local fecha=`date +%Y%m%d` |
---|
| 139 | |
---|
| 140 | if [ ! -f $fichero ]; then |
---|
| 141 | errorAndLog "${FUNCNAME}(): file $fichero doesn't exists" |
---|
| 142 | return 1 |
---|
| 143 | fi |
---|
| 144 | |
---|
[ebbbfc01] | 145 | echoAndLog "${FUNCNAME}(): Making $fichero back-up" |
---|
[a0867b37] | 146 | |
---|
| 147 | # realiza una copia de la última configuración como last |
---|
[6ef01d9] | 148 | cp -a $fichero "${fichero}-LAST" |
---|
[a0867b37] | 149 | |
---|
| 150 | # si para el día no hay backup lo hace, sino no |
---|
| 151 | if [ ! -f "${fichero}-${fecha}" ]; then |
---|
[6ef01d9] | 152 | cp -a $fichero "${fichero}-${fecha}" |
---|
[a0867b37] | 153 | fi |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | # Restaura un fichero desde su copia de seguridad |
---|
| 157 | function restoreFile() |
---|
| 158 | { |
---|
| 159 | if [ $# -ne 1 ]; then |
---|
| 160 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
| 161 | exit 1 |
---|
| 162 | fi |
---|
| 163 | |
---|
| 164 | local fichero=$1 |
---|
| 165 | |
---|
[ebbbfc01] | 166 | echoAndLog "${FUNCNAME}(): restoring file $fichero" |
---|
[a0867b37] | 167 | if [ -f "${fichero}-LAST" ]; then |
---|
[6ef01d9] | 168 | cp -a "$fichero-LAST" "$fichero" |
---|
[a0867b37] | 169 | fi |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | ##################################################################### |
---|
[295b4ab] | 174 | ####### Funciones de acceso a base de datos |
---|
| 175 | ##################################################################### |
---|
| 176 | |
---|
| 177 | # Actualizar la base datos |
---|
| 178 | function importSqlFile() |
---|
| 179 | { |
---|
| 180 | if [ $# -ne 4 ]; then |
---|
| 181 | errorAndLog "${FNCNAME}(): invalid number of parameters" |
---|
| 182 | exit 1 |
---|
| 183 | fi |
---|
| 184 | |
---|
| 185 | local dbuser="$1" |
---|
| 186 | local dbpassword="$2" |
---|
| 187 | local database="$3" |
---|
| 188 | local sqlfile="$4" |
---|
| 189 | local tmpfile=$(mktemp) |
---|
| 190 | local status |
---|
| 191 | |
---|
| 192 | if [ ! -r $sqlfile ]; then |
---|
| 193 | errorAndLog "${FUNCNAME}(): Unable to read $sqlfile!!" |
---|
| 194 | return 1 |
---|
| 195 | fi |
---|
| 196 | |
---|
| 197 | echoAndLog "${FUNCNAME}(): importing SQL file to ${database}..." |
---|
| 198 | chmod 600 $tmpfile |
---|
| 199 | sed -e "s/SERVERIP/$SERVERIP/g" -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ |
---|
| 200 | -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" $sqlfile > $tmpfile |
---|
| 201 | mysql -u$dbuser -p"$dbpassword" --default-character-set=utf8 "$database" < $tmpfile |
---|
| 202 | status=$? |
---|
| 203 | rm -f $tmpfile |
---|
| 204 | if [ $status -ne 0 ]; then |
---|
| 205 | errorAndLog "${FUNCNAME}(): error importing $sqlfile in database $database" |
---|
| 206 | return 1 |
---|
| 207 | fi |
---|
| 208 | echoAndLog "${FUNCNAME}(): file imported to database $database" |
---|
| 209 | return 0 |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | |
---|
| 213 | ##################################################################### |
---|
[a0867b37] | 214 | ####### Funciones de instalación de paquetes |
---|
| 215 | ##################################################################### |
---|
| 216 | |
---|
| 217 | # Instalar las deependencias necesarias para el actualizador. |
---|
[64dd765] | 218 | function installDependencies() |
---|
[a0867b37] | 219 | { |
---|
| 220 | if [ $# = 0 ]; then |
---|
| 221 | echoAndLog "${FUNCNAME}(): no deps needed." |
---|
[c1e00e4] | 222 | else |
---|
| 223 | while [ $# -gt 0 ]; do |
---|
[ebbbfc01] | 224 | dpkg -s $1 2>/dev/null | grep -q "Status: install ok" |
---|
[c1e00e4] | 225 | if [ $? -ne 0 ]; then |
---|
| 226 | INSTALLDEPS="$INSTALLDEPS $1" |
---|
| 227 | fi |
---|
| 228 | shift |
---|
| 229 | done |
---|
| 230 | if [ -n "$INSTALLDEPS" ]; then |
---|
[ebbbfc01] | 231 | apt-get update && apt-get -y install --force-yes $INSTALLDEPS |
---|
[c1e00e4] | 232 | if [ $? -ne 0 ]; then |
---|
| 233 | errorAndLog "${FUNCNAME}(): cannot install some dependencies: $INSTALLDEPS." |
---|
| 234 | return 1 |
---|
| 235 | fi |
---|
| 236 | fi |
---|
| 237 | fi |
---|
[a0867b37] | 238 | } |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | ##################################################################### |
---|
| 242 | ####### Funciones para el manejo de Subversion |
---|
| 243 | ##################################################################### |
---|
| 244 | |
---|
| 245 | function svnExportCode() |
---|
| 246 | { |
---|
| 247 | if [ $# -ne 1 ]; then |
---|
| 248 | errorAndLog "${FUNCNAME}(): invalid number of parameters" |
---|
| 249 | exit 1 |
---|
| 250 | fi |
---|
| 251 | |
---|
[27dc5ff] | 252 | local url="$1" |
---|
[a0867b37] | 253 | |
---|
| 254 | echoAndLog "${FUNCNAME}(): downloading subversion code..." |
---|
| 255 | |
---|
[7ad4465] | 256 | svn checkout "${url}" opengnsys |
---|
[a0867b37] | 257 | if [ $? -ne 0 ]; then |
---|
| 258 | errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password" |
---|
| 259 | return 1 |
---|
| 260 | fi |
---|
| 261 | echoAndLog "${FUNCNAME}(): subversion code downloaded" |
---|
| 262 | return 0 |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | ############################################################ |
---|
| 267 | ### Detectar red |
---|
| 268 | ############################################################ |
---|
| 269 | |
---|
[07c3a59] | 270 | # Comprobar si existe conexión. |
---|
| 271 | function checkNetworkConnection() |
---|
| 272 | { |
---|
| 273 | OPENGNSYS_SERVER=${OPENGNSYS_SERVER:-"www.opengnsys.es"} |
---|
| 274 | wget --spider -q $OPENGNSYS_SERVER |
---|
| 275 | } |
---|
| 276 | |
---|
[739fb00] | 277 | # Obtener los parámetros de red del servidor. |
---|
| 278 | function getNetworkSettings() |
---|
| 279 | { |
---|
| 280 | # Variables globales definidas: |
---|
| 281 | # - SERVERIP: IP local de la interfaz por defecto. |
---|
| 282 | |
---|
| 283 | local DEVICES |
---|
| 284 | local dev |
---|
| 285 | |
---|
| 286 | echoAndLog "${FUNCNAME}(): Detecting network parameters." |
---|
| 287 | DEVICES="$(ip -o link show up | awk '!/loopback/ {sub(/:.*/,"",$2); print $2}')" |
---|
| 288 | for dev in $DEVICES; do |
---|
| 289 | [ -z "$SERVERIP" ] && SERVERIP=$(ip -o addr show dev $dev | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4)}') |
---|
| 290 | done |
---|
| 291 | } |
---|
| 292 | |
---|
[a0867b37] | 293 | |
---|
| 294 | ##################################################################### |
---|
| 295 | ####### Funciones específicas de la instalación de Opengnsys |
---|
| 296 | ##################################################################### |
---|
| 297 | |
---|
[45f1fe8] | 298 | # Actualizar cliente OpenGnSys |
---|
[295b4ab] | 299 | function updateClientFiles() |
---|
[45f1fe8] | 300 | { |
---|
| 301 | echoAndLog "${FUNCNAME}(): Updating OpenGnSys Client files." |
---|
| 302 | rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/shared/* $INSTALL_TARGET/client |
---|
| 303 | if [ $? -ne 0 ]; then |
---|
| 304 | errorAndLog "${FUNCNAME}(): error while updating client structure" |
---|
[51b179a] | 305 | exit 1 |
---|
[45f1fe8] | 306 | fi |
---|
| 307 | find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null |
---|
| 308 | |
---|
| 309 | echoAndLog "${FUNCNAME}(): Updating OpenGnSys Cloning Engine files." |
---|
[51b179a] | 310 | rsync --exclude .svn -irplt $WORKDIR/opengnsys/client/engine/*.lib* $INSTALL_TARGET/client/lib/engine/bin |
---|
[45f1fe8] | 311 | if [ $? -ne 0 ]; then |
---|
| 312 | errorAndLog "${FUNCNAME}(): error while updating engine files" |
---|
[51b179a] | 313 | exit 1 |
---|
[45f1fe8] | 314 | fi |
---|
| 315 | |
---|
[51b179a] | 316 | echoAndLog "${FUNCNAME}(): client files update success." |
---|
[45f1fe8] | 317 | } |
---|
[4e51cb0] | 318 | |
---|
[3ce53a7] | 319 | # Configurar HTTPS y exportar usuario y grupo del servicio Apache. |
---|
| 320 | function apacheConfiguration () |
---|
[4e51cb0] | 321 | { |
---|
[3ce53a7] | 322 | local APACHECONF=/etc/apache2 |
---|
| 323 | |
---|
| 324 | # Activar HTTPS, si es necesario. |
---|
| 325 | if [ -e $APACHECONF/sites-available/opengnsys.conf ]; then |
---|
| 326 | echoAndLog "${FUNCNAME}(): Configuring HTTPS access..." |
---|
| 327 | mv $APACHECONF/sites-available/opengnsys.conf $APACHECONF/sites-available/opengnsys |
---|
| 328 | a2ensite default-ssl |
---|
| 329 | a2enmod ssl |
---|
[3e24aa5] | 330 | a2dissite opengnsys.conf |
---|
[3ce53a7] | 331 | a2ensite opengnsys |
---|
| 332 | /etc/init.d/apache2 restart |
---|
| 333 | fi |
---|
| 334 | |
---|
| 335 | # Variables de ejecución de Apache. |
---|
[4e51cb0] | 336 | # - APACHE_RUN_USER |
---|
| 337 | # - APACHE_RUN_GROUP |
---|
[3ce53a7] | 338 | if [ -f $APACHECONF/envvars ]; then |
---|
| 339 | source $APACHECONF/envvars |
---|
[4e51cb0] | 340 | fi |
---|
| 341 | APACHE_RUN_USER=${APACHE_RUN_USER:-"www-data"} |
---|
| 342 | APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-"www-data"} |
---|
| 343 | } |
---|
| 344 | |
---|
[a0867b37] | 345 | # Copiar ficheros del OpenGnSys Web Console. |
---|
| 346 | function updateWebFiles() |
---|
| 347 | { |
---|
[d655cc4] | 348 | local ERRCODE |
---|
[a0867b37] | 349 | echoAndLog "${FUNCNAME}(): Updating web files..." |
---|
[d655cc4] | 350 | backupFile $INSTALL_TARGET/www/controlacceso.php |
---|
| 351 | mv $INSTALL_TARGET/www $INSTALL_TARGET/WebConsole |
---|
[1db2ed8] | 352 | rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/WebConsole $INSTALL_TARGET |
---|
[d655cc4] | 353 | ERRCODE=$? |
---|
| 354 | mv $INSTALL_TARGET/WebConsole $INSTALL_TARGET/www |
---|
[c1e00e4] | 355 | unzip -o $WORKDIR/opengnsys/admin/xajax_0.5_standard.zip -d $INSTALL_TARGET/www/xajax |
---|
[d655cc4] | 356 | if [ $ERRCODE != 0 ]; then |
---|
[a0867b37] | 357 | errorAndLog "${FUNCNAME}(): Error updating web files." |
---|
| 358 | exit 1 |
---|
| 359 | fi |
---|
[d655cc4] | 360 | restoreFile $INSTALL_TARGET/www/controlacceso.php |
---|
[a0867b37] | 361 | # Cambiar permisos para ficheros especiales. |
---|
[ebbbfc01] | 362 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/includes $INSTALL_TARGET/www/images/iconos |
---|
[a0867b37] | 363 | echoAndLog "${FUNCNAME}(): Web files updated successfully." |
---|
| 364 | } |
---|
| 365 | |
---|
[72134d5] | 366 | # Copiar carpeta de Interface |
---|
[64dd765] | 367 | function updateInterfaceAdm() |
---|
[72134d5] | 368 | { |
---|
[27dc5ff] | 369 | local errcode=0 |
---|
[72134d5] | 370 | |
---|
| 371 | # Crear carpeta y copiar Interface |
---|
| 372 | echoAndLog "${FUNCNAME}(): Copying Administration Interface Folder" |
---|
| 373 | mv $INSTALL_TARGET/client/interfaceAdm $INSTALL_TARGET/client/Interface |
---|
| 374 | rsync --exclude .svn -irplt $WORKDIR/opengnsys/admin/Interface $INSTALL_TARGET/client |
---|
[27dc5ff] | 375 | errcoce=$? |
---|
[72134d5] | 376 | mv $INSTALL_TARGET/client/Interface $INSTALL_TARGET/client/interfaceAdm |
---|
[27dc5ff] | 377 | if [ $errcode -ne 0 ]; then |
---|
[72134d5] | 378 | echoAndLog "${FUNCNAME}(): error while updating admin interface" |
---|
| 379 | exit 1 |
---|
| 380 | fi |
---|
| 381 | chmod -R +x $INSTALL_TARGET/client/interfaceAdm |
---|
[b6f1726] | 382 | chown $OPENGNSYS_CLIENTUSER:$OPENGNSYS_CLIENTUSER $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso |
---|
[f6c1d2b] | 383 | chmod 700 $INSTALL_TARGET/client/interfaceAdm/CambiarAcceso |
---|
[72134d5] | 384 | echoAndLog "${FUNCNAME}(): Admin interface updated successfully." |
---|
| 385 | } |
---|
[a0867b37] | 386 | |
---|
[5d6bf97] | 387 | # Crear documentación Doxygen para la consola web. |
---|
| 388 | function makeDoxygenFiles() |
---|
| 389 | { |
---|
| 390 | echoAndLog "${FUNCNAME}(): Making Doxygen web files..." |
---|
| 391 | $WORKDIR/opengnsys/installer/ogGenerateDoc.sh \ |
---|
| 392 | $WORKDIR/opengnsys/client/engine $INSTALL_TARGET/www |
---|
| 393 | if [ ! -d "$INSTALL_TARGET/www/html" ]; then |
---|
| 394 | errorAndLog "${FUNCNAME}(): unable to create Doxygen web files." |
---|
| 395 | return 1 |
---|
| 396 | fi |
---|
[45f1fe8] | 397 | rm -fr "$INSTALL_TARGET/www/api" |
---|
[15b2a4e] | 398 | mv "$INSTALL_TARGET/www/html" "$INSTALL_TARGET/www/api" |
---|
| 399 | rm -fr $INSTALL_TARGET/www/{man,perlmod,rtf} |
---|
[5d6bf97] | 400 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/api |
---|
| 401 | echoAndLog "${FUNCNAME}(): Doxygen web files created successfully." |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | |
---|
[a0867b37] | 405 | # Crea la estructura base de la instalación de opengnsys |
---|
| 406 | function createDirs() |
---|
| 407 | { |
---|
[eb9424f] | 408 | # Crear estructura de directorios. |
---|
[a0867b37] | 409 | echoAndLog "${FUNCNAME}(): creating directory paths in ${INSTALL_TARGET}" |
---|
[7bb72f7] | 410 | local dir |
---|
| 411 | |
---|
[cfad47b] | 412 | mkdir -p ${INSTALL_TARGET}/{bin,doc,etc,lib,sbin,www} |
---|
| 413 | mkdir -p ${INSTALL_TARGET}/{client,images} |
---|
[a0867b37] | 414 | mkdir -p ${INSTALL_TARGET}/log/clients |
---|
[eb9424f] | 415 | ln -fs ${INSTALL_TARGET}/log /var/log/opengnsys |
---|
[7bb72f7] | 416 | # Detectar directorio de instalación de TFTP. |
---|
| 417 | if [ ! -L ${INSTALL_TARGET}/tftpboot ]; then |
---|
| 418 | for dir in /var/lib/tftpboot /srv/tftp; do |
---|
| 419 | [ -d $dir ] && ln -fs $dir ${INSTALL_TARGET}/tftpboot |
---|
| 420 | done |
---|
| 421 | fi |
---|
[cfad47b] | 422 | mkdir -p ${INSTALL_TARGET}/tftpboot/{pxelinux.cfg,menu.lst} |
---|
[a0867b37] | 423 | if [ $? -ne 0 ]; then |
---|
| 424 | errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?" |
---|
| 425 | return 1 |
---|
| 426 | fi |
---|
| 427 | |
---|
[eb9424f] | 428 | # Crear usuario ficticio. |
---|
| 429 | if id -u $OPENGNSYS_CLIENTUSER &>/dev/null; then |
---|
| 430 | echoAndLog "${FUNCNAME}(): user \"$OPENGNSYS_CLIENTUSER\" is already created" |
---|
| 431 | else |
---|
| 432 | echoAndLog "${FUNCNAME}(): creating OpenGnSys user" |
---|
| 433 | useradd $OPENGNSYS_CLIENTUSER 2>/dev/null |
---|
| 434 | if [ $? -ne 0 ]; then |
---|
| 435 | errorAndLog "${FUNCNAME}(): error creating OpenGnSys user" |
---|
| 436 | return 1 |
---|
| 437 | fi |
---|
| 438 | fi |
---|
| 439 | |
---|
| 440 | # Establecer los permisos básicos. |
---|
| 441 | echoAndLog "${FUNCNAME}(): setting directory permissions" |
---|
[cfad47b] | 442 | chmod -R 775 $INSTALL_TARGET/{log/clients,images,tftpboot/pxelinux.cfg,tftpboot/menu.lst} |
---|
| 443 | chown -R :$OPENGNSYS_CLIENTUSER $INSTALL_TARGET/{log/clients,images,tftpboot/pxelinux.cfg,tftpboot/menu.lst} |
---|
[eb9424f] | 444 | if [ $? -ne 0 ]; then |
---|
| 445 | errorAndLog "${FUNCNAME}(): error while setting permissions" |
---|
| 446 | return 1 |
---|
| 447 | fi |
---|
| 448 | |
---|
[a0867b37] | 449 | echoAndLog "${FUNCNAME}(): directory paths created" |
---|
| 450 | return 0 |
---|
| 451 | } |
---|
| 452 | |
---|
| 453 | # Copia ficheros de configuración y ejecutables genéricos del servidor. |
---|
[64dd765] | 454 | function updateServerFiles() |
---|
[bb30a50] | 455 | { |
---|
[c1e00e4] | 456 | # No copiar ficheros del antiguo cliente Initrd |
---|
[873cf1e] | 457 | local SOURCES=( repoman/bin \ |
---|
[c1e00e4] | 458 | server/bin \ |
---|
[873cf1e] | 459 | server/tftpboot \ |
---|
[bb30a50] | 460 | installer/opengnsys_uninstall.sh \ |
---|
[873cf1e] | 461 | doc ) |
---|
| 462 | local TARGETS=( bin \ |
---|
| 463 | bin \ |
---|
| 464 | tftpboot \ |
---|
[4057c5d] | 465 | lib/opengnsys_uninstall.sh \ |
---|
[873cf1e] | 466 | doc ) |
---|
[a0867b37] | 467 | |
---|
| 468 | if [ ${#SOURCES[@]} != ${#TARGETS[@]} ]; then |
---|
| 469 | errorAndLog "${FUNCNAME}(): inconsistent number of array items" |
---|
| 470 | exit 1 |
---|
| 471 | fi |
---|
| 472 | |
---|
| 473 | echoAndLog "${FUNCNAME}(): updating files in server directories" |
---|
| 474 | pushd $WORKDIR/opengnsys >/dev/null |
---|
| 475 | local i |
---|
| 476 | for (( i = 0; i < ${#SOURCES[@]}; i++ )); do |
---|
[27dc5ff] | 477 | if [ -d "$INSTALL_TARGET/${TARGETS[i]}" ]; then |
---|
[4057c5d] | 478 | rsync --exclude .svn -irplt "${SOURCES[i]}" $(dirname $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}")) |
---|
[aa36857] | 479 | else |
---|
[4057c5d] | 480 | rsync --exclude .svn -irplt "${SOURCES[i]}" $(readlink -e "$INSTALL_TARGET/${TARGETS[i]}") |
---|
[aa36857] | 481 | fi |
---|
[a0867b37] | 482 | done |
---|
| 483 | popd >/dev/null |
---|
[df3cd7f] | 484 | NEWFILES="" # Ficheros de configuración que han cambiado de formato. |
---|
[f80f839] | 485 | if grep -q 'pxelinux.0' /etc/dhcp*/dhcpd*.conf; then |
---|
[df3cd7f] | 486 | echoAndLog "${FUNCNAME}(): updating DHCP files" |
---|
[f80f839] | 487 | perl -pi -e 's/pxelinux.0/grldr/' /etc/dhcp*/dhcpd*.conf |
---|
| 488 | for i in isc-dhcp-server dhcpd3-server dhcpd; do |
---|
| 489 | [ -f /etc/init.d/$i ] && /etc/init.d/$i restart |
---|
| 490 | done |
---|
[df3cd7f] | 491 | NEWFILES="/etc/dhcp*/dhcpd*.conf" |
---|
| 492 | fi |
---|
| 493 | if ! diff --quiet $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys 2>/dev/null; then |
---|
| 494 | echoAndLog "${FUNCNAME}(): updating new init file" |
---|
| 495 | backupFile /etc/init.d/opengnsys |
---|
| 496 | cp -a $WORKDIR/opengnsys/admin/Sources/Services/opengnsys.init /etc/init.d/opengnsys |
---|
| 497 | NEWFILES="$NEWFILES /etc/init.d/opengnsys" |
---|
| 498 | fi |
---|
[984093e] | 499 | if grep -q "UrlMsg=.*msgbrowser.php" $INSTALL_TARGET/client/etc/ogAdmClient.cfg 2>/dev/null; then |
---|
[df3cd7f] | 500 | echoAndLog "${FUNCNAME}(): updating new client config file" |
---|
| 501 | backupFile $INSTALL_TARGET/client/etc/ogAdmClient.cfg |
---|
| 502 | perl -pi -e 's!UrlMsg=.*msgbrowser\.php!UrlMsg=http://localhost/cgi-bin/httpd-log\.sh!g' $INSTALL_TARGET/client/etc/ogAdmClient.cfg |
---|
| 503 | NEWFILES="$NEWFILES $INSTALL_TARGET/client/etc/ogAdmClient.cfg" |
---|
[f80f839] | 504 | fi |
---|
[9ee62ad] | 505 | echoAndLog "${FUNCNAME}(): updating cron files" |
---|
[57cf15b] | 506 | echo "* * * * * root [ -x $INSTALL_TARGET/bin/opengnsys.cron ] && $INSTALL_TARGET/bin/opengnsys.cron" > /etc/cron.d/opengnsys |
---|
[9ee62ad] | 507 | echo "* * * * * root [ -x $INSTALL_TARGET/bin/torrent-creator ] && $INSTALL_TARGET/bin/torrent-creator" > /etc/cron.d/torrentcreator |
---|
[da8db11] | 508 | echoAndLog "${FUNCNAME}(): server files updated successfully." |
---|
[a0867b37] | 509 | } |
---|
| 510 | |
---|
| 511 | #################################################################### |
---|
| 512 | ### Funciones de compilación de código fuente de servicios |
---|
| 513 | #################################################################### |
---|
| 514 | |
---|
[bb30a50] | 515 | # Recompilar y actualiza los serivicios y clientes. |
---|
[64dd765] | 516 | function compileServices() |
---|
[a0867b37] | 517 | { |
---|
[bb30a50] | 518 | local hayErrores=0 |
---|
| 519 | |
---|
| 520 | # Compilar OpenGnSys Server |
---|
| 521 | echoAndLog "${FUNCNAME}(): Recompiling OpenGnSys Admin Server" |
---|
| 522 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmServer |
---|
| 523 | make && mv ogAdmServer $INSTALL_TARGET/sbin |
---|
| 524 | if [ $? -ne 0 ]; then |
---|
| 525 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Admin Server" |
---|
| 526 | hayErrores=1 |
---|
| 527 | fi |
---|
| 528 | popd |
---|
| 529 | # Compilar OpenGnSys Repository Manager |
---|
| 530 | echoAndLog "${FUNCNAME}(): Recompiling OpenGnSys Repository Manager" |
---|
| 531 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmRepo |
---|
| 532 | make && mv ogAdmRepo $INSTALL_TARGET/sbin |
---|
| 533 | if [ $? -ne 0 ]; then |
---|
| 534 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Repository Manager" |
---|
| 535 | hayErrores=1 |
---|
| 536 | fi |
---|
| 537 | popd |
---|
| 538 | # Compilar OpenGnSys Agent |
---|
| 539 | echoAndLog "${FUNCNAME}(): Recompiling OpenGnSys Agent" |
---|
| 540 | pushd $WORKDIR/opengnsys/admin/Sources/Services/ogAdmAgent |
---|
| 541 | make && mv ogAdmAgent $INSTALL_TARGET/sbin |
---|
| 542 | if [ $? -ne 0 ]; then |
---|
| 543 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Agent" |
---|
| 544 | hayErrores=1 |
---|
| 545 | fi |
---|
| 546 | popd |
---|
| 547 | |
---|
[a0867b37] | 548 | # Compilar OpenGnSys Client |
---|
[bb30a50] | 549 | echoAndLog "${FUNCNAME}(): Recompiling OpenGnSys Client" |
---|
[72134d5] | 550 | pushd $WORKDIR/opengnsys/admin/Sources/Clients/ogAdmClient |
---|
[e473667] | 551 | make && mv ogAdmClient $INSTALL_TARGET/client/bin |
---|
[a0867b37] | 552 | if [ $? -ne 0 ]; then |
---|
| 553 | echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Client" |
---|
| 554 | hayErrores=1 |
---|
| 555 | fi |
---|
| 556 | popd |
---|
| 557 | |
---|
| 558 | return $hayErrores |
---|
| 559 | } |
---|
| 560 | |
---|
| 561 | |
---|
| 562 | #################################################################### |
---|
[4e51cb0] | 563 | ### Funciones instalacion cliente OpenGnSys |
---|
[a0867b37] | 564 | #################################################################### |
---|
| 565 | |
---|
[c1e00e4] | 566 | # Actualizar nuevo cliente para OpenGnSys 1.0 |
---|
| 567 | function updateClient() |
---|
| 568 | { |
---|
[df3cd7f] | 569 | local DOWNLOADURL="http://$OPENGNSYS_SERVER/downloads" |
---|
[739fb00] | 570 | local FILENAME=ogLive-oneiric-3.0.0-14-generic-r2439.iso |
---|
[0b85cc93] | 571 | local SOURCEFILE=$DOWNLOADURL/$FILENAME |
---|
| 572 | local TARGETFILE=$INSTALL_TARGET/lib/$FILENAME |
---|
| 573 | local SOURCELENGTH |
---|
| 574 | local TARGETLENGTH |
---|
| 575 | local TMPDIR=/tmp/${FILENAME%.iso} |
---|
[a63345ac] | 576 | local OGINITRD=$INSTALL_TARGET/tftpboot/ogclient/oginitrd.img |
---|
| 577 | local SAMBAPASS |
---|
[0b85cc93] | 578 | |
---|
| 579 | # Comprobar si debe actualizarse el cliente. |
---|
[c3cc6b0] | 580 | SOURCELENGTH=$(LANG=C wget --spider $SOURCEFILE 2>&1 | awk '/Length:/ {print $2}') |
---|
[d168a46] | 581 | TARGETLENGTH=$(ls -l $TARGETFILE 2>/dev/null | awk '{print $5}') |
---|
[d4e90c1] | 582 | [ -z $TARGETLENGTH ] && TARGETLENGTH=0 |
---|
[0b85cc93] | 583 | if [ "$SOURCELENGTH" != "$TARGETLENGTH" ]; then |
---|
| 584 | echoAndLog "${FUNCNAME}(): Loading Client" |
---|
| 585 | wget $DOWNLOADURL/$FILENAME -O $TARGETFILE |
---|
| 586 | if [ ! -s $TARGETFILE ]; then |
---|
| 587 | errorAndLog "${FUNCNAME}(): Error loading OpenGnSys Client" |
---|
| 588 | return 1 |
---|
| 589 | fi |
---|
[a63345ac] | 590 | # Obtener la clave actual de acceso a Samba para restaurarla. |
---|
| 591 | if [ -f $OGINITRD ]; then |
---|
| 592 | SAMBAPASS=$(gzip -dc $OGINITRD | \ |
---|
| 593 | cpio -i --to-stdout scripts/ogfunctions 2>&1 | \ |
---|
[c3cc6b0] | 594 | grep "^[ ]*OPTIONS=" | \ |
---|
[a63345ac] | 595 | sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/') |
---|
| 596 | fi |
---|
| 597 | # Montar la imagen ISO del ogclient, actualizar ficheros y desmontar. |
---|
| 598 | echoAndLog "${FUNCNAME}(): Updatting ogclient files" |
---|
| 599 | mkdir -p $TMPDIR |
---|
| 600 | mount -o loop,ro $TARGETFILE $TMPDIR |
---|
| 601 | rsync -irlt $TMPDIR/ogclient $INSTALL_TARGET/tftpboot |
---|
| 602 | umount $TMPDIR |
---|
| 603 | rmdir $TMPDIR |
---|
| 604 | # Recuperar la clave de acceso a Samba. |
---|
| 605 | if [ -n "$SAMBAPASS" ]; then |
---|
| 606 | echoAndLog "${FUNCNAME}(): Restoring client access key" |
---|
| 607 | echo -ne "$SAMBAPASS\n$SAMBAPASS\n" | \ |
---|
| 608 | $INSTALL_TARGET/bin/setsmbpass |
---|
| 609 | fi |
---|
| 610 | # Establecer los permisos. |
---|
| 611 | find -L $INSTALL_TARGET/tftpboot -type d -exec chmod 755 {} \; |
---|
| 612 | find -L $INSTALL_TARGET/tftpboot -type f -exec chmod 644 {} \; |
---|
| 613 | chown -R :$OPENGNSYS_CLIENTUSER $INSTALL_TARGET/tftpboot/ogclient |
---|
| 614 | chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/tftpboot/{menu.lst,pxelinux.cfg} |
---|
[e1c01217] | 615 | |
---|
[e8963d0] | 616 | # Ofrecer md5 del kernel y vmlinuz para ogupdateinitrd en cache |
---|
[7bb72f7] | 617 | cp -av $INSTALL_TARGET/tftpboot/ogclient/ogvmlinuz* $INSTALL_TARGET/tftpboot |
---|
| 618 | cp -av $INSTALL_TARGET/tftpboot/ogclient/oginitrd.img* $INSTALL_TARGET/tftpboot |
---|
[e1c01217] | 619 | |
---|
[a63345ac] | 620 | echoAndLog "${FUNCNAME}(): Client update successfully" |
---|
[0b85cc93] | 621 | else |
---|
[a63345ac] | 622 | echoAndLog "${FUNCNAME}(): Client is already updated" |
---|
[c1e00e4] | 623 | fi |
---|
| 624 | } |
---|
[a0867b37] | 625 | |
---|
[eb9424f] | 626 | # Resumen de actualización. |
---|
| 627 | function updateSummary() |
---|
| 628 | { |
---|
| 629 | # Actualizar fichero de versión y revisión. |
---|
| 630 | local VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" |
---|
| 631 | local REVISION=$(LANG=C svn info $SVN_URL|awk '/Revision:/ {print "r"$2}') |
---|
| 632 | |
---|
| 633 | [ -f $VERSIONFILE ] || echo "OpenGnSys" >$VERSIONFILE |
---|
| 634 | perl -pi -e "s/($| r[0-9]*)/ $REVISION/" $VERSIONFILE |
---|
| 635 | |
---|
| 636 | echo |
---|
| 637 | echoAndLog "OpenGnSys Update Summary" |
---|
[df3cd7f] | 638 | echo "========================" |
---|
| 639 | echoAndLog "Project version: $(cat $VERSIONFILE)" |
---|
| 640 | if [ -n "$NEWFILES" ]; then |
---|
| 641 | echoAndLog "Check the new config files: $(echo $NEWFILES)" |
---|
| 642 | fi |
---|
[eb9424f] | 643 | echo |
---|
| 644 | } |
---|
| 645 | |
---|
| 646 | |
---|
[a0867b37] | 647 | |
---|
| 648 | ##################################################################### |
---|
[3320409] | 649 | ####### Proceso de actualización de OpenGnSys |
---|
[a0867b37] | 650 | ##################################################################### |
---|
| 651 | |
---|
| 652 | |
---|
| 653 | echoAndLog "OpenGnSys update begins at $(date)" |
---|
| 654 | |
---|
[bb30a50] | 655 | pushd $WORKDIR |
---|
| 656 | |
---|
[27dc5ff] | 657 | # Comprobar si hay conexión y detectar parámetros de red por defecto. |
---|
| 658 | checkNetworkConnection |
---|
| 659 | if [ $? -ne 0 ]; then |
---|
| 660 | errorAndLog "Error connecting to server. Causes:" |
---|
| 661 | errorAndLog " - Network is unreachable, review devices parameters." |
---|
| 662 | errorAndLog " - You are inside a private network, configure the proxy service." |
---|
| 663 | errorAndLog " - Server is temporally down, try agian later." |
---|
| 664 | exit 1 |
---|
| 665 | fi |
---|
[739fb00] | 666 | getNetworkSettings |
---|
[27dc5ff] | 667 | |
---|
[64dd765] | 668 | # Comprobar auto-actualización del programa. |
---|
| 669 | if [ "$PROGRAMDIR" != "$INSTALL_TARGET/bin" ]; then |
---|
| 670 | checkAutoUpdate |
---|
| 671 | if [ $? -ne 0 ]; then |
---|
[f580c51] | 672 | echoAndLog "OpenGnSys updater has been overwritten." |
---|
| 673 | echoAndLog "Please, re-execute this script." |
---|
[64dd765] | 674 | exit |
---|
| 675 | fi |
---|
| 676 | fi |
---|
| 677 | |
---|
[bb30a50] | 678 | # Instalar dependencias. |
---|
[a0867b37] | 679 | installDependencies $DEPS |
---|
| 680 | if [ $? -ne 0 ]; then |
---|
| 681 | errorAndLog "Error: you may install all needed dependencies." |
---|
| 682 | exit 1 |
---|
| 683 | fi |
---|
| 684 | |
---|
| 685 | # Arbol de directorios de OpenGnSys. |
---|
| 686 | createDirs ${INSTALL_TARGET} |
---|
| 687 | if [ $? -ne 0 ]; then |
---|
| 688 | errorAndLog "Error while creating directory paths!" |
---|
| 689 | exit 1 |
---|
| 690 | fi |
---|
| 691 | |
---|
| 692 | # Si es necesario, descarga el repositorio de código en directorio temporal |
---|
| 693 | if [ $USESVN -eq 1 ]; then |
---|
| 694 | svnExportCode $SVN_URL |
---|
| 695 | if [ $? -ne 0 ]; then |
---|
| 696 | errorAndLog "Error while getting code from svn" |
---|
| 697 | exit 1 |
---|
| 698 | fi |
---|
| 699 | else |
---|
| 700 | ln -fs "$(dirname $PROGRAMDIR)" opengnsys |
---|
| 701 | fi |
---|
| 702 | |
---|
[295b4ab] | 703 | # Si existe fichero de actualización de la base de datos; aplicar cambios. |
---|
| 704 | INSTVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt) |
---|
| 705 | REPOVERSION=$(awk '{print $2}' $WORKDIR/opengnsys/doc/VERSION.txt) |
---|
| 706 | OPENGNSYS_DBUPDATEFILE="$WORKDIR/opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-$REPOVERSION.sql" |
---|
| 707 | if [ -f $OPENGNSYS_DBUPDATEFILE ]; then |
---|
| 708 | echoAndLog "Updating tables from version $INSTVERSION to $REPOVERSION" |
---|
| 709 | importSqlFile $OPENGNSYS_DBUSER $OPENGNSYS_DBPASSWORD $OPENGNSYS_DATABASE $OPENGNSYS_DBUPDATEFILE |
---|
| 710 | else |
---|
| 711 | echoAndLog "Database unchanged." |
---|
| 712 | fi |
---|
| 713 | |
---|
| 714 | # Actualizar ficheros complementarios del servidor |
---|
[a0867b37] | 715 | updateServerFiles |
---|
| 716 | if [ $? -ne 0 ]; then |
---|
[da8db11] | 717 | errorAndLog "Error updating OpenGnSys Server files" |
---|
[a0867b37] | 718 | exit 1 |
---|
| 719 | fi |
---|
| 720 | |
---|
[295b4ab] | 721 | # Actualizar ficheros del cliente |
---|
| 722 | updateClientFiles |
---|
| 723 | updateInterfaceAdm |
---|
[45f1fe8] | 724 | |
---|
[295b4ab] | 725 | # Actualizar páqinas web |
---|
[3ce53a7] | 726 | apacheConfiguration |
---|
[a0867b37] | 727 | updateWebFiles |
---|
| 728 | if [ $? -ne 0 ]; then |
---|
[da8db11] | 729 | errorAndLog "Error updating OpenGnSys Web Admin files" |
---|
[a0867b37] | 730 | exit 1 |
---|
| 731 | fi |
---|
[5d6bf97] | 732 | # Generar páginas Doxygen para instalar en el web |
---|
| 733 | makeDoxygenFiles |
---|
[a0867b37] | 734 | |
---|
[bb30a50] | 735 | # Recompilar y actualizar los servicios del sistema |
---|
| 736 | compileServices |
---|
| 737 | |
---|
| 738 | # Actaulizar ficheros auxiliares del cliente |
---|
[a0867b37] | 739 | updateClient |
---|
| 740 | if [ $? -ne 0 ]; then |
---|
| 741 | errorAndLog "Error updating clients" |
---|
| 742 | exit 1 |
---|
| 743 | fi |
---|
| 744 | |
---|
[3320409] | 745 | # Eliminamos el fichero de estado del tracker porque es incompatible entre los distintos paquetes |
---|
[ebbbfc01] | 746 | if [ -f /tmp/dstate ]; then |
---|
| 747 | rm -f /tmp/dstate |
---|
[3320409] | 748 | fi |
---|
| 749 | |
---|
[eb9424f] | 750 | # Mostrar resumen de actualización. |
---|
| 751 | updateSummary |
---|
| 752 | |
---|
[a0867b37] | 753 | #rm -rf $WORKDIR |
---|
| 754 | echoAndLog "OpenGnSys update finished at $(date)" |
---|
| 755 | |
---|
| 756 | popd |
---|
| 757 | |
---|