summaryrefslogtreecommitdiffstats
path: root/client/shared/scripts/restoreBaseImage
diff options
context:
space:
mode:
authoririna <irinagomez@us.es>2014-04-21 11:58:04 +0000
committeririna <irinagomez@us.es>2014-04-21 11:58:04 +0000
commitc8bbcdc04f2c3960623c414552dbd1450451b162 (patch)
treed4301ac25aee8d1fe01b275f7fb11e19d4d72e70 /client/shared/scripts/restoreBaseImage
parent5b893bee9f58790a7d1aaca28ae60324421d45ee (diff)
#565 se resuelve problema de corromper la imagen sincronizada al reducirla
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4240 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/shared/scripts/restoreBaseImage')
-rwxr-xr-xclient/shared/scripts/restoreBaseImage22
1 files changed, 10 insertions, 12 deletions
diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage
index 9d8fd1be..318e7c6f 100755
--- a/client/shared/scripts/restoreBaseImage
+++ b/client/shared/scripts/restoreBaseImage
@@ -63,17 +63,21 @@ REPOFILE="$(ogGetPath "REPO" "$2.$IMGEXT")" || exit $(ogRaiseError session $OG_E
# Comprobar que es sincronizable (con REPO)
ogIsSyncImage REPO "$2" $IMGEXT || exit $(ogRaiseError session $OG_ERR_DONTSYNC_IMAGE "$1 $2"; echo $?)
+IMGEXT="img"
+# Comprobamos si la imagen o la particion estan bloqueada:
+ogIsImageLocked "$1" "$2.$IMGEXT" && exit $(ogRaiseError session $OG_ERR_LOCKED "$1 $2.$IMGEXT"; echo $?)
+ogIsLocked "$3" "$4" && exit $(ogRaiseError session $OG_ERR_LOCKED "$3 $4"; echo $?)
+
# Detectamos el sistema de ficheros de la imagen
# TODO ogGetImageInfo
DIRMOUNT=$(ogMountImage "$1" "$2")
-ogWaitMountImage "$1" "$2" "$IMGEXT" || exit $(ogRaiseError session $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out."; echo $?)
+ogWaitSyncImage "$1" "$2" "$IMGEXT" "mounted" || exit $(ogRaiseError session $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out."; echo $?)
IMGFSTYPE=$(head -1 $DIRMOUNT/ogimg.info |cut -d: -f3)
# Comprobamos si el sistema de ficheros se puede montar
ogMount "$3" "$4" &>/dev/null || RETVAL=$?
# Si da error formateamos el sistema de ficheros.
if [ "$RETVAL" ] ; then
- ogUnmountImage $1 "$2"
ogEcho log session " $MSG_HELP_ogFormat: $3 $4 $IMGFSTYPE"
ogFormat "$3" "$4" "$IMGFSTYPE" || exit $(ogRaiseError session $OG_ERR_FILESYS "$3 $4"; echo $?)
ogMount "$3" "$4" || exit $(ogRaiseError session $OG_ERR_FILESYS "$3 $4"; echo $?)
@@ -82,11 +86,6 @@ fi
# Warning si el sistema de ficheros de la imagen es distinto del de la particion destino
[ "$IMGFSTYPE" == "$(ogGetFsType $3 $4)" ] || ogEcho session warning "$MSG_SYNC_DIFFERENTFS"
-IMGEXT="img"
-
-# Comprobamos si la imagen o la particion estan bloqueada:
-ogIsImageLocked "$1" "$2.$IMGEXT" && exit $(ogRaiseError session $OG_ERR_LOCKED "$1 $2.$IMGEXT"; echo $?)
-ogIsLocked "$3" "$4" && exit $(ogRaiseError session $OG_ERR_LOCKED "$3 $4"; echo $?)
PROTO=${5:-"UNICAST"}
if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
@@ -106,6 +105,9 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
TIMEAUX1=$[SECONDS-TIME]
ogEcho log session " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX1/60]m $[TIMEAUX1%60]s"
+ # Montamos la imagen de cache
+ ogMountImage "$1" "$2" >/dev/null
+ ogWaitSyncImage "$1" "$2" "$IMGEXT" "mounted" || exit $(ogRaiseError session $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out."; echo $?)
fi
TIME2=$SECONDS
@@ -115,10 +117,6 @@ ogEcho log session "[40] $MSG_HELP_ogRestoreImage: $1 $2 $3 $4"
ogLock $3 $4
-# Montamos la imagen basica.
-ogMountImage "$1" "$2" "$IMGEXT" >/dev/null
-# Comprobar que la imagen completa se ha montado.
-ogWaitMountImage "$1" "$2" "$IMGEXT" || exit $(ogRaiseError session $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out."; echo $?)
# Sincronizamos la particiĆ³n con la imagen.
ogEcho log session "[60] $MSG_HELP_ogSyncRestore: $1 $2 $IMGEXT $3 $4"
ogSyncRestore "$1" "$2" "$IMGEXT" $3 $4
@@ -134,7 +132,7 @@ ogUnmountImage "$1" "$2" "$IMGEXT"
# Restableciendo acl
ogUnlock $3 $4
ogEcho log session "[70] $MSG_HELP_ogRestoreInfoImage"
-ogRestoreInfoImage $3 $4
+ogRestoreInfoImage $3 $4 2>&1 | tee -a $OGLOGCOMMAND
# Llamar al script de post-configuraciĆ³n del sistema operativo.
# Si a este script lo ha llamado el script restoreDiffImage no post-configuramos