summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclient/engine/Rsync.lib36
-rwxr-xr-xclient/shared/scripts/restoreBaseImage20
2 files changed, 10 insertions, 46 deletions
diff --git a/client/engine/Rsync.lib b/client/engine/Rsync.lib
index aa4e2d95..d157450b 100755
--- a/client/engine/Rsync.lib
+++ b/client/engine/Rsync.lib
@@ -93,42 +93,6 @@ fi
}
-#/**
-# ogSetSizeInfo [REPO|CACHE] nombre_imagen extension tamaño
-#@brief Configuramos la informacion del tamaño de los datos, para diferenciales
-#@param 1 Repositorio [ REPO | CACHE ] (opcional en las completas)
-#@param 2 Nombre Imagen Basica (opcional en las completas)
-#@param 3 Extensión [ img | diff ]
-#@param 4 Tamaño de los datos.
-function ogSetSizeInfo () {
-local DIRMOUNT UMOUNT
-
-if [ "$*" == "help" ]; then
- ogHelp "$FUNCNAME" "$FUNCNAME [ REPO|CACHE ] image_name extension size_data " \
- "base image -> $FUNCNAME REPO Ubuntu12 img 34000000" \
- "diff image -> $FUNCNAME CACHE Windows7 diff 500000"
- return
-fi
-
-if [ $# -lt 4 ]; then
- ogRaiseError $OG_ERR_FORMAT "$FUNCNAME [ REPO|CACHE ] image_name extension size_data "
- return $?
-fi
-
-DIRMOUNT=$(ogGetMountDir "$2" $3)
-[ "$1" == "CACHE" -o "$1" == "cache" ] && DIRMOUNT="/tmp/$DIRMOUNT" || DIRMOUNT="$OGIMG/$DIRMOUNT"
-
-# Si no esta montada la imagen se monta.
-[ -r $DIRMOUNT/ogimg.info ] && UMOUNT=false || ogMountImage $1 "$2" $3
-# se configura el tamaño
-echo sed -i s/SIZEDATA/"$4"/g $DIRMOUNT/ogimg.info
-sed -i s/SIZEDATA/"$4"/g $DIRMOUNT/ogimg.info
-# se desmonta, si no estaba montada.
-[ "$UMOUNT" == false ] || ogUnmountImage $1 "$2" $3
-
-
-}
-
function ogCreateInfoImage () {
#/**
# ogCreateInfoImage
diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage
index d049396e..d2e3c6a1 100755
--- a/client/shared/scripts/restoreBaseImage
+++ b/client/shared/scripts/restoreBaseImage
@@ -56,24 +56,24 @@ fi
# Procesar parámetros de entrada
REPOFILE=$(ogGetPath "REPO" "$2.$IMGEXT") || ogRaiseError $OG_ERR_NOTFOUND "REPO, $2.$IMGEXT"
+
+# Comprobar que es sincronizable (con REPO)
+file $REPOFILE | grep " BTRFS Filesystem" 2>&1 > /dev/null || ogRaiseError $OG_ERR_DONTSYNC_IMAGE "$1 $2"
+
# Comprobamos si el sistema de ficheros se puede montar
-ogMount "$3" "$4" &>/dev/null
-if [ $? -ne 0 ] ; then
+ogMount "$3" "$4" &>/dev/null || RETVAL=$?
+# Si da error formateamos el sistema de ficheros.
+if [ "$RETVAL" ] ; then
# TODO ogGetImageInfo
- DIRMOUNT="/tmp/mount$$"
- mkdir $DIRMOUNT
- mount -o compress=lzo $REPOFILE $DIRMOUNT
+ DIRMOUNT=$(ogMountImage "$1" "$2")
+ ogWaitMountImage "$1" "$2" "$IMGEXT" || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $IMGEXT: time_out."
FSTYPE=$(head -1 $DIRMOUNT/ogimg.info |cut -d: -f3)
- umount $DIRMOUNT
+ ogUnmountImage $1 "$2"
echo " $MSG_HELP_ogFormat: $3 $4 $FSTYPE" | tee -a $OGLOGFILE
ogFormat "$3" "$4" "$FSTYPE" || ogRaiseError $OG_ERR_FILESYS "$3 $4"
ogMount "$3" "$4" || ogRaiseError $OG_ERR_FILESYS "$3 $4"
fi
-
-# Comprobar que es sincronizable (con REPO)
-file $REPOFILE | grep " BTRFS Filesystem" 2>&1 > /dev/null || ogRaiseError $OG_ERR_DONTSYNC_IMAGE "$1 $2"
-
echo "[1] $MSG_SCRIPTS_START $0 $*" | tee -a $OGLOGFILE
IMGEXT="img"