source: client/shared/scripts/initCache @ ca0f67c6

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

Rama version1.0:

  • Redistribución de directorios para el cliente.
  • Modificación del instalador para adaptarse a la nueva estructura de directorios.
  • Desinstalador quita los recursos de OpenGnSys en Samba.
  • Documentación actualizada para la nueva versión.

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

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#!/bin/bash
2# Scirpt de iniciación de la caché local de disco.
3# (puede usarse como base para el programa de restauración de imágenes usado por OpenGnSys Admin).
4# Versión: 0.9.1, 2009/03/17, - Ramón Gómez, Univ. Sevilla - Versión inicial.
5# Versión: 0.9.2, 2010/07/27, - Ramón Gómez, Univ. Sevilla - redefinir parámetro.
6
7TIME1=$SECONDS
8PROG="$(basename $0)"
9if [ $# -ne 1 ]; then
10    ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG -1 | 0 | tamaño"
11    exit $?
12fi
13
14# Si tamaño no es numérico o tamaño<-1, error.
15if [ -n "${1//[-0-9]/}" ] || [ $1 -lt -1 ]; then
16    ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG -1 | 0 | tamaño"
17    exit $?
18fi
19# Si tamaño=0, no hacer nada.
20if [ $1 -eq 0 ]; then
21    echo "No modificar la caché local."
22    exit
23fi
24# Si tamaño=-1, borrar caché.
25if [ $1 -eq -1 ]; then
26    echo "[10] Trabajar sin caché local."
27    ogUnmountCache 2>/dev/null
28    ogDeleteCache
29else
30    # Si tamaño>0, ...
31    if [ ! $1 -gt 0 ]; then
32        ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: !($1>0)"
33        exit $?
34    fi
35    # Si no existe caché o si cambia su tamaño, crearla.
36    SIZE=$(ogGetCacheSize 2>/dev/null)
37    if [ "$1" != "$SIZE" ]; then
38        echo "[10] Crar partición de caché local."
39        ogUnmountCache 2>/dev/null
40        ogCreateCache "$1"
41    fi
42    # Si caché no montada y no formateada, formatear.
43    CACHE=$(ogFindCache) || exit $?
44    if ! ogIsFormated $CACHE; then
45        echo "[50] Formatear caché local."
46        ogFormatCache
47    fi
48    echo "[70] Montar caché local."
49    ogMountCache 2>/dev/null
50    # Si error al montar, chequear sistema de archivos y volver a montar.
51    if [ $? != 0 ]; then
52        echo "[80] Comprobar y montar caché local."
53        ogCheckFs $CACHE
54        ogMountCache || exit $?
55    fi
56fi
57# Duración del proceso.
58TIME=$[SECONDS-TIME1]
59echo "[100] Duración de la operación $[TIME/60]m $[TIME%60]s"
60
Note: See TracBrowser for help on using the repository browser.