source: client/engine/Image.lib.testing @ 8850d1b

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 8850d1b was 9948203, checked in by adv <adv@…>, 14 years ago

integracion version 1.0 - engine -- ticket:305

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

  • Property mode set to 100644
File size: 16.6 KB
Line 
1#!/bin/bash
2#/**
3#@file    Image.lib
4#@brief   Librería o clase Image testing
5#@class   Image
6#@brief   Funciones para creación, restauración y clonación de imágenes de sistemas.
7#@version 0.9
8#@warning License: GNU GPLv3+
9#*/
10#/**
11#         ogCheckProgram
12#@brief   Función para determinar si el programa/s están disponibles
13#@param 1 programa o programas a comprobar
14#@return  0 si está disponible.
15#@return  7 si NO está disponible
16#@exception OG_ERR_FORMAT     formato incorrecto.
17#@exception OG_ERR_NOTEXEC     programas no disponibles.
18#@note   
19#@TODO: en pruebas
20#@version 0.91 - Definición de
21#@author  Antonio Doblas Viso, Universidad de Málaga
22#@date    2010/05/09
23#*/ ##
24#/**
25ogCheckProgram ()
26{
27# Si se solicita, mostrar ayuda.
28if [ "$*" == "help" ]; then
29    ogHelp "$FUNCNAME \"str_program1 program2 programN\" " \
30                   "$FUNCNAME \"partimage partclone mbuffer\" "
31    return
32fi
33
34# Error si no se recibe 1 parámetro.
35[ $# == 1 ] || ogRaiseError $OG_ERR_FORMAT || return $?
36
37local PERROR PLOG
38PERROR=0
39PLOG=" "
40for i in `echo $1`
41do
42  if [ ! `which $i` ]
43     then
44        PERROR=1
45        PLOG="$PLOG $i"
46     fi
47done
48if [ "$PERROR" == "1" ]
49then
50        ogRaiseError $OG_ERR_NOTEXEC "$PLOG" || return $?
51else           
52        return 0
53fi
54}
55
56
57function ogPartcloneSyntax ()
58{
59#TODO: comprobar como unico parametro particion /dev/sda1
60#COMPAR="partclone.$FS --clone --force --source $PART"
61COMPAR="-F -c -s "
62TYPE="$(ogGetFsType `ogDevToDisk $1`)"
63case "$TYPE" in
64    EXT[234])
65        echo "partclone.extfs $COMPAR $1"
66        ;;
67    REISERFS|XFS|JFS)
68        echo "partclone.dd $COMPAR $1"
69        ;;
70    NTFS|HNTFS)
71        echo "partclone.ntfs $COMPAR $1"
72        ;;
73    FAT16|FAT32|HFAT16|HFAT32)
74        echo "partclone.fat $COMPAR $1"
75        ;;
76    HFS|HFS+)
77        echo "partclone.hfsp $COMPAR $1"
78        ;;
79    *)  ogRaiseError $OG_ERR_PARTITION "$1 $TYPE"
80        return $? ;;
81esac   
82}
83
84
85#/**
86#         ogGetImageInfo filename
87#@brief   muestra información sobre la imagen monolitica.
88#@param 1   filename           path absoluto del fichero imagen
89#@return  cadena compuesta por clonacion:compresor:sistemaarchivos:tamañoKB
90#@exception OG_ERR_FORMAT    formato incorrecto.
91#@exception OG_ERR_NOTFOUND   fichero no encontrado.
92#@exception OG_ERR_IMAGE        "Image format is not valid $IMGFILE"
93
94#@warning En pruebas iniciales
95#@TODO    Definir sintaxis de salida (herramienta y compresor en minuscula)
96#@TODO    Arreglar loop para ntfsclone
97#@TODO    insertar parametros entrada tipo OG
98#@version 1.0 - Primeras pruebas
99#@author  Antonio J. Doblas Viso. Universidad de Málaga
100#@date    2010/02/08
101#*/ ##
102
103function ogGetImageInfo () {
104# Si se solicita, mostrar ayuda.
105if [ "$*" == "help" ]; then
106    ogHelp "$FUNCNAME" "$FUNCNAME  filename " \
107           "$FUNCNAME  /opt/opengnsys/images/prueba.img "
108    return
109fi
110
111# Error si no se reciben 1 parámetros.
112[ $# == 1 ] || ogRaiseError $OG_ERR_FORMAT || return $?
113
114#comprobando que el parametro uno es un file.
115[ -f $1 ] || ogRaiseError $OG_ERR_NOTFOUND "$1" || return $?
116
117local TOOLS COMPRESSOR IMGFILE FILEHEAD FS SIZE PARTIMAGEINFO PARTCLONEINFO NTFSCLONEINFO IMGDETECT
118IMGDETECT="FALSE"
119
120IMGFILE=$1
121FILEHEAD=/tmp/`basename $IMGFILE`.infohead
122COMPRESSOR=`file $IMGFILE | awk '{print $2}'`
123ogCheckStringInGroup "$COMPRESSOR" "gzip lzop" || ogRaiseError $OG_ERR_IMAGE "Image format is not valid $IMGFILE" || return $?
124$($COMPRESSOR -dc $IMGFILE 2>/dev/null | head > $FILEHEAD) || ogRaiseError $OG_ERR_IMAGE "Image format is not valid $IMGFILE" || return $?
125
126## buscando Primera opción.
127if [ "$IMGDETECT" == "FALSE" ]
128then
129        PARTCLONEINFO=$(partclone.info $FILEHEAD 2>&1)
130        if `echo $PARTCLONEINFO | grep size > /dev/null`
131        then
132                TOOLS=PARTCLONE
133                FS=$(echo $PARTCLONEINFO | awk '{gsub(/\: /,"\n"); print toupper($8);}')
134                SIZE=$(echo $PARTCLONEINFO | awk '{gsub(/\: /,"\n"); printf "%d\n", $11*1024*1024;}')
135                IMGDETECT="TRUE"
136        fi
137fi
138#buscando segunda opcion.
139if [ "$IMGDETECT" == "FALSE" -a ! -f /dev/loop2  ]
140then
141        cat $FILEHEAD | grep -w ntfsclone-image > /dev/null && NTFSCLONEINFO=$(cat $FILEHEAD | ntfsclone --restore --overwrite /dev/loop2 - 2>&1)
142        if `echo $NTFSCLONEINFO | grep ntfsclone > /dev/null` 
143        then
144                TOOLS=NTFSCLONE
145                SIZE=$(echo $NTFSCLONEINFO | awk '{gsub(/\(|\)|\./,""); printf "%d\n",$17/1000;}')
146                FS=NTFS
147                IMGDETECT="TRUE"
148        fi
149fi
150## buscando Tercer opción.
151if [ "$IMGDETECT" == "FALSE" ]
152then
153        PARTIMAGEINFO=$(partimage -B gui=no imginfo "$FILEHEAD" 2>&1)
154        if `echo $PARTIMAGEINFO | grep Partition > /dev/null`
155        then   
156                TOOLS=PARTIMAGE
157                FS=$(echo $PARTIMAGEINFO | awk '{gsub(/ /,"\n"); print $17;}' | awk '{sub(/\.\.+/," "); print toupper($2)}')
158                SIZE=$( echo $PARTIMAGEINFO | awk '{gsub(/ /,"\n"); print $36;}' | awk '{sub(/\.\.+/," "); printf "%d\n",$2*1024*1024;}')
159                IMGDETECT="TRUE"
160        fi     
161fi
162#comprobamos valores #Chequeamos los valores devueltos.
163if [ -z "$TOOLS" -o -z "$COMPRESSOR" -o "$IMGDETECT" == "FALSE" ]
164then
165        ogRaiseError $OG_ERR_IMAGE "Image format is not valid $IMGFILE" || return $?
166else
167        COMPRESSOR=$(echo $COMPRESSOR | tr [a-z] [A-Z])
168        echo $TOOLS:$COMPRESSOR:$FS:$SIZE
169fi
170}
171
172
173
174
175#/**
176#         ogCreateImageSyntax partition filename [tools]  [levelcompresor]
177#@brief   Genera una cadena de texto con la instrucción para crear un fichero imagen
178#@param 1  partition             identificador linux del dispositivo particion.
179#@param 2  filename           path absoluto del fichero imagen
180#@param 3  [opcional] str_tools          herrmaienta de clonacion [partimage, partclone, ntfsclone]
181#@param 4  [opcional] str_levelcompresor nivel de compresion. [0 -none-, 1-lzop-, 2-gzip]
182#@return  cadena con el comando que se debe ejecutar.
183#@exception OG_ERR_FORMAT    formato incorrecto.
184#@warning En pruebas iniciales
185#@TODO    introducir las herramientas fsarchiver, dd
186#@TODO    introducir el nivel de compresion gzip
187#@version 1.0 - Primeras pruebas
188#@author  Antonio J. Doblas Viso. Universidad de Málaga
189#@date    2010/02/08
190#*/ ##
191
192function ogCreateImageSyntax()
193{
194local FS TOOL LEVEL PART IMGFILE BUFFER
195
196# Si se solicita, mostrar ayuda.
197if [ "$*" == "help" ]; then
198    ogHelp "$FUNCNAME" "$FUNCNAME partition filename [tool] [levelcompresor]" \
199           "$FUNCNAME /dev/sda1 /opt/opengnsys/images/prueba.img partclone lzop"
200    return
201fi
202# Error si no se reciben al menos los 2 parámetros para obtener el valor default.
203[ $# -lt 2 ] && ogRaiseError $OG_ERR_FORMAT && return $?
204
205
206PART=`echo $1`
207IMGFILE=`echo $2`
208
209case "$#" in
210   "2")
211        # Sintaxis por defecto OG PART IMGFILE
212        #echo "partimage -M -f3 -o -d -V0 -B gui=no -c -z1 save $PART $IMGFILE"
213    # Se comenta la instruccion que debería ir aqui
214    ogCreateImageSyntax $1 $2 partclone gzip
215   ;;
216   "4")
217        # Sintaxis condicionada.
218        # comprobamos parametro herramienta compresion.
219        TOOL=$(echo $3 | tr [A-Z] [a-z])       
220        #ogCheckProgram $TOOL
221        #comprobar parámetro compresor.
222        LEVEL=$(echo $4 | tr [A-Z] [a-z])
223        #ogCheckProgram $LEVEL
224
225        # herramienta
226        case "$TOOL" in
227                "ntfsclone")
228                        PARAM1="ntfsclone --force --save-image -O - $PART"
229                ;;
230                "partimage"|DEFAULT)
231                        PARAM1="partimage -M -f3 -o -d -B gui=no -c -z0 --volume=0 save $PART stdout"
232                ;;
233                "partclone")
234                        PARAM1=`ogPartcloneSyntax $PART` || ogRaiseError $OG_ERR_FORMAT || return $?
235                ;;
236        esac
237        # mbuffer
238        which mbuffer > /dev/null && PARAM2="| mbuffer -q -m 40M " || PARAM2=" "
239
240        # nivel de compresion
241        case "$LEVEL" in
242        "0"|"none")
243                PARAM3=" > "
244        ;;
245        "1"|"lzop")
246                PARAM3=" | lzop > "
247        ;;
248        "2"|"gzip")
249                PARAM3=" | gzip -c > "
250        ;;
251        "3"|"bzip")
252                PARAM3=" | bzip -c > "
253        ;;
254        esac
255        #sintaxis final.
256        echo "$PARAM1 $PARAM2 $PARAM3 $IMGFILE"
257        ;;
258esac
259}
260
261#/**
262#         ogRestoreImageSyntax filename partition [tools]  [levelcompresor]
263#@brief   Genera una cadena de texto con la instrucción para crear un fichero imagen
264#@param 1  filename           path absoluto del fichero imagen
265#@param 2  partition             identificador linux del dispositivo particion.
266#@param 3  [opcional] str_tools          herrmaienta de clonacion [partimage, partclone, ntfsclone]
267#@param 4  [opcional] str_levelcompresor nivel de compresion. [0 -none-, 1-lzop-, 2-gzip]
268#@return  cadena con el comando que se debe ejecutar.
269#@exception OG_ERR_FORMAT    formato incorrecto.
270#@warning En pruebas iniciales
271#@TODO    introducir las herramientas fsarchiver, dd
272#@TODO    introducir el nivel de compresion gzip
273#@version 1.0 - Primeras pruebas
274#@author  Antonio J. Doblas Viso. Universidad de Málaga
275#@date    2010/02/08
276#*/ ##
277
278ogRestoreImageSyntax ()
279{
280local TOOL COMPRESSOR LEVEL PART IMGFILE FILEHEAD INFOIMG
281
282
283# Si se solicita, mostrar ayuda.
284if [ "$*" == "help" ]; then
285    ogHelp "$FUNCNAME" "$FUNCNAME  filename partition [tool] [levelcompresor]" \
286           "$FUNCNAME  /opt/opengnsys/images/prueba.img /dev/sda1 [partclone] [lzop]"
287    return
288fi
289
290# Error si no se reciben al menos 2 parámetros.
291[ $# -lt 2 ] && ogRaiseError $OG_ERR_FORMAT && return $?
292
293# controlamos que el parametro 1 (imagen) es tipo file.
294[ -f $1 ] || ogRaiseError $OG_ERR_NOTFOUND "$1" || return $?
295
296# Si 2 parametros (file-origen-, device-destino-) = ogGetImageFull($1)
297if [ "$#" -eq 2 ]; then
298        IMGFILE=$1
299        PART=$2
300        INFOIMG=$(ogGetImageInfo $IMGFILE) || ogRaiseError $OG_ERR_NOTFOUND "No Image $1" || return $?
301        TOOL=`echo $INFOIMG | cut -f1 -d:`
302        COMPRESSOR=`echo $INFOIMG | cut -f2 -d:`
303        ogRestoreImageSyntax $IMGFILE $PART $TOOL $COMPRESSOR
304fi
305
306
307# Si cuatro parametros genera sintaxis
308if [ "$#" -eq 4 ]; then
309        IMGFILE=$1
310        PART=$2
311        # comprobamos parametro herramienta compresion.
312        TOOL=$(echo $3 | tr [A-Z] [a-z])       
313        #ogCheckProgram $TOOL
314        #comprobar parámetro compresor.
315        LEVEL=$(echo $4 | tr [A-Z] [a-z])
316        #ogCheckProgram $LEVEL
317       
318        case "$LEVEL" in
319        "0"|"none")
320                COMPRESSOR=" "
321        ;;
322        "1"|"lzop" | "LZOP")
323                COMPRESSOR=" lzop -dc "
324        ;;
325        "2"|"gzip" | "GZIP")
326                COMPRESSOR=" gzip -dc "
327        ;;
328        "3"|"bzip" | "BZIP" )
329                COMPRESSOR=" bzip -dc "
330        ;;
331        *)
332                ogRaiseError $OG_ERR_NOTFOUND "Compressor no valid $TOOL" || return $?
333        ;;
334        esac
335    #comprobar mbuffer
336        which mbuffer > /dev/null && MBUFFER="| mbuffer -q -m 40M " || MBUFFER=" "
337
338        case "$TOOL" in
339                "ntfsclone" | "NTFSCLONE")
340                        TOOL="| ntfsclone --restore-image --overwrite $PART -"
341                ;;
342                "partimage"| "PARTIMAGE")
343                        TOOL="| partimage -f3 -B gui=no restore $PART stdin"
344                ;;
345                "partclone" | "PARTCLONE")
346                    # -C para que no compruebe tamaños
347                        TOOL="| partclone.restore -o $PART"
348                ;;
349                *)
350                ogRaiseError $OG_ERR_NOTFOUND "Tools imaging no valid $TOOL" || return $?
351        ;;
352        esac
353
354        echo "$COMPRESSOR $IMGFILE $MBUFFER $TOOL"
355fi
356
357}
358
359
360function ogGetImageProgram ()
361{
362local IMGFILE
363IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
364[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
365ogGetImageInfo $IMGFILE | awk -F: '{print $1}'
366
367}
368
369function ogGetImageCompressor ()
370{
371local IMGFILE
372IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
373[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
374ogGetImageInfo $IMGFILE | awk -F: '{print $2}'
375}
376
377#######################
378###########################
379###########################
380
381
382
383function ogGetImageType ()
384{
385local IMGFILE
386IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
387[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
388#partimage -B gui=no imginfo "$IMGFILE" 2>&1 | \
389#        awk '/^Filesystem/ {sub(/\.\.+/," "); sub(/fs$/,""); print toupper($2);}'
390ogGetImageInfo $IMGFILE | awk -F: '{print $3}'
391
392}
393
394
395
396
397
398function ogGetImageSize ()
399{
400# Variables locales
401local IMGFILE
402
403# Si se solicita, mostrar ayuda.
404if [ "$*" == "help" ]; then
405    ogHelp "$FUNCNAME" "$FUNCNAME testing path_dir str_image int_ndisk int_npart" \
406           "$FUNCNAME 1 1 REPO /aula1/winxp  ==>  5642158"
407    return
408fi
409# Error si no se reciben menos de 2 parámetros.
410[ $# -lt 2 ] && ogRaiseError $OG_ERR_FORMAT && return $?
411# Error si el fichero de imagen no es accesible.
412IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
413[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
414
415# Devuelve el tamaño de la imagen en KB.
416#partimage -B gui=no imginfo "$IMGFILE" 2>&1 | \
417#        awk '/Partition size/ {sub(/\.\.+/," "); printf "%d\n",$3*1024*1024;}'
418ogGetImageInfo $IMGFILE | awk -F: '{print $4}'
419}
420
421
422#/**
423#         ogCreateImage int_ndisk int_npartition str_repo path_image
424#@brief   Crea una imagen a partir de una partición.
425#@param   int_ndisk      nº de orden del disco
426#@param   int_npartition nº de orden de la partición
427#@param   str_repo       repositorio de imágenes (remoto o caché local)
428#@param   path_image     camino de la imagen (sin extensión)
429#@return  (nada, por determinar)
430#@note    repo = { REPO, CACHE }
431#@exception OG_ERR_FORMAT    formato incorrecto.
432#@exception OG_ERR_NOTFOUND  fichero o dispositivo no encontrado.
433#@exception OG_ERR_PARTITION partición no accesible o no soportada.
434#@exception OG_ERR_LOCKED    particion bloqueada por otra operación.
435#@exception OG_ERR_IMAGE     error al crear la imagen del sistema.
436#@warning En pruebas iniciales
437#@todo    Comprobaciones, control de errores, definir parámetros, etc.
438#@version 0.1 -  Integracion para Opengnsys  -  HIDRA:CrearImagen{EXT3, NTFS}.sh;  EAC: CreateImageFromPartition () en Deploy.lib
439#@author Ramon Gomez, ETSII Universidad de Sevilla
440#@Date    2008/05/13
441#@author  Antonio J. Doblas Viso. Universidad de Malaga
442#@date    2008/10/27
443#@version 0.9 - Versión en pruebas para OpenGnSys
444#@author  Ramon Gomez, ETSII Universidad de Sevilla
445#@date    2009/10/07
446#*/ ##
447function ogCreateImage ()
448{
449# Variables locales
450local PART PROGRAM IMGDIR IMGFILE IMGTYPE ERRCODE
451
452# TESTING mensajes
453# Si se solicita, mostrar ayuda.
454if [ "$*" == "help" ]; then
455    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npart str_repo path_image [str_tools] [str_levelcompresor]" \
456           "$FUNCNAME 1 1 REPO /aula1/winxp " \
457           "$FUNCNAME 1 1 REPO /aula1/winxp partclone lzop" \
458           "$FUNCNAME 1 1 REPO /aula1/winxp partimage gzip" \
459           "$FUNCNAME 1 1 REPO /aula1/winxp ntfsclone lzop"
460    return
461fi
462# TESTING de -n a -lt
463# Error si no se reciben 4 parámetros.
464[ $# -lt 4 ] && ogRaiseError $OG_ERR_FORMAT && return $?
465
466# Comprobar que no está bloqueada ni la partición, ni la imagen.
467PART="$(ogDiskToDev $1 $2)" || return $?
468if ogIsLocked $1 $2; then
469    ogRaiseError $OG_ERR_LOCKED "$MSG_PARTITION $1, $2"
470    return $?
471fi
472IMGTYPE="img"                   # Extensión genérica de imágenes.
473IMGDIR=$(ogGetParentPath "$3" "$4")
474[ -n "$IMGDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$3 $(dirname $4)" || return $?
475IMGFILE="$IMGDIR/$(basename "$4").$IMGTYPE"
476if ogIsImageLocked "$IMGFILE"; then
477    ogRaiseError $OG_ERR_LOCKED "$MSG_IMAGE $3, $4"
478    return $?
479fi
480# Desmontar partición, bloquear partición e imagen.
481ogUnmount $1 $2 2>/dev/null
482ogLock $1 $2 || return $?
483ogLockImage "$3" "$4.$IMGTYPE" || return $?
484
485# Crear Imagen.
486trap "ogUnlock $1 $2; ogUnlockImage "$3" "$4.$IMGTYPE"; rm -f $IMGFILE" 1 2 3 6 9
487
488################## TESTING #########################################
489#Solicitamos la generación de la instruccion a ejecutar
490PROGRAM=`ogCreateImageSyntax $PART $IMGFILE $5 $6`
491echo $PROGRAM
492eval $PROGRAM
493
494# Controlar salida de error y desbloquear partición.
495ERRCODE=$?
496if [ $ERRCODE != 0 ]; then
497    ogRaiseError $OG_ERR_IMAGE "$1 $2 $IMGFILE"
498    rm -f "$IMGFILE"
499fi
500ogUnlock $1 $2
501ogUnlockImage "$3" "$4.$IMGTYPE"
502return $ERRCODE
503}
504
505
506
507
508function ogRestoreImage ()
509{
510# Variables locales
511local PART PROGRAM PARTSIZE IMGFILE IMGSIZE FSTYPE
512
513# Si se solicita, mostrar ayuda.
514if [ "$*" == "help" ]; then
515    ogHelp "$FUNCNAME" "$FUNCNAME path_dir str_image int_ndisk int_npart" \
516           "$FUNCNAME REPO /aula1/winxp 1 1"
517    return
518fi
519# Error si no se reciben 4 parámetros.
520[ $# -lt 4 ] && ogRaiseError $OG_ERR_FORMAT && return $?
521
522# Procesar parámetros.
523PART="$(ogDiskToDev "$3" "$4")" || return $?
524IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
525[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
526
527
528# Error si la imagen no cabe en la particion.
529IMGSIZE=$(ogGetImageSize "$1" "$2")
530PARTSIZE=$(ogGetPartitionSize $3 $4)
531if [ $IMGSIZE -gt $PARTSIZE ]; then
532    ogRaiseError $OG_ERR_PARTITION "$IMGSIZE > $PARTSIZE"
533    return $?
534    else
535    echo "Tamanio de la imagen $IMGSIZE < al tamanio particion $PARTSIZE"
536fi
537
538# Comprobar el bloqueo de la imagen y de la partición.
539if ogIsImageLocked "$IMGFILE"; then
540    ogRaiseError $OG_ERR_LOCKED "$MSG_IMAGE $1, $2"
541    return $?
542fi
543if ogIsLocked $3 $4; then
544    ogRaiseError $OG_ERR_LOCKED "$MSG_PARTITION $3, $4"
545    return $?
546fi
547# Desmontar y bloquear partición.
548ogUnmount $3 $4 2>/dev/null || return $?
549ogLock $3 $4 || return $?
550trap "ogUnlock $3 $4" 1 2 3 6 9
551
552
553#Solicitamos la generación de la instruccion a ejecutar
554PROGRAM=`ogRestoreImageSyntax  $IMGFILE $PART`
555echo $PROGRAM
556eval $PROGRAM
557
558
559ERRCODE=$?
560if [ $ERRCODE != 0 ]; then
561    ogRaiseError $OG_ERR_IMAGE "$IMGFILE, $3, $4"
562fi
563ogUnlock $3 $4
564return $ERRCODE
565
566}
Note: See TracBrowser for help on using the repository browser.