diff options
author | irina <irinagomez@us.es> | 2014-03-04 13:07:35 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2014-03-04 13:07:35 +0000 |
commit | 30ad471609a53482410d51b66f0c9f764c2e944a (patch) | |
tree | fdd9c2b594b417e399b86d509c874ed2f0608789 /client/shared/scripts/createBaseImage | |
parent | 46f7d6f1ff72d67b3aa2963400353678790b18ef (diff) |
#565 #636 revisión mensajes de error en las sincronizadas.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4173 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/shared/scripts/createBaseImage')
-rwxr-xr-x | client/shared/scripts/createBaseImage | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/client/shared/scripts/createBaseImage b/client/shared/scripts/createBaseImage index 50e41952..a0499c56 100755 --- a/client/shared/scripts/createBaseImage +++ b/client/shared/scripts/createBaseImage @@ -24,12 +24,11 @@ #@date 2012-12-04 #*/ ## -trap "onexit $1 $2 $3 \"$4\"" 1 2 3 6 9 14 15 ERR +trap "onexit $1 $2 $3 \"$4\"" 1 2 3 6 9 14 15 EXIT # Si salimos con error demontamos la imagen y desbloqueamos la imagen y la particion function onexit() { local exit_status=$? - echo -e "\n $PROG error ${MSG_INTERFACE_END#*\]} $exit_status" |tee -a $OGLOGFILE $OGLOGSESSION ogUnmountImage $3 "$4" $IMGEXT &>/dev/null if [ $exit_status -ne 4 ]; then ogUnlockImage "$3" "/$4.$IMGEXT" @@ -62,8 +61,7 @@ if [ "$*" == "help" ]; then exit 0 fi -[ $# -ne 4 ] && ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG ndisco nparticion REPO|CACHE imagen" - +[ $# -ne 4 ] && exit $(ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG ndisco nparticion REPO|CACHE imagen" ; echo $?) # Limpiamos fichero de log echo " " > $OGLOGCOMMAND @@ -77,30 +75,29 @@ REPOIP=$(ogGetRepoIp) # Comprobamos si la imagen o la particion estan bloqueada: -ogIsImageLocked "$3" "$4.$IMGEXT" && ogRaiseError $OG_ERR_LOCKED "$3 $4.$IMGEXT" -ogIsLocked "$1" "$2" && ogRaiseError $OG_ERR_LOCKED "$1 $2" +ogIsImageLocked "$3" "$4.$IMGEXT" && exit $(ogRaiseError $OG_ERR_LOCKED "$3 $4.$IMGEXT"; echo $?) +ogIsLocked "$1" "$2" && exit $(ogRaiseError $OG_ERR_LOCKED "$1 $2"; echo $?) # Si el repositorio es CACHE comprobamos que exista if [ "$3" == "CACHE" -o "$3" == "cache" ]; then - ! ogFindCache >/dev/null && ogRaiseError $OG_ERR_NOTCACHE "CACHE " + ! ogFindCache >/dev/null && exit $(ogRaiseError $OG_ERR_NOTCACHE "CACHE "; echo $?) fi #Comprobamos acceso de escritura. DIRTEMP="/$4$(date +%Y%m%d-%H%M%S)" -ogMakeDir $3 "$DIRTEMP" 2>/dev/null || ogRaiseError $OG_ERR_NOTWRITE "$3" && ogDeleteTree $3 "$DIRTEMP" +ogMakeDir $3 "$DIRTEMP" 2>/dev/null && ogDeleteTree $3 "$DIRTEMP" || exit $(ogRaiseError $OG_ERR_NOTWRITE "$3" ; echo $?) # Obtener información de los parámetros de entrada. -PART=$(ogDiskToDev "$1" "$2" 2>/dev/null) || ogRaiseError $OG_ERR_PARTITION "$1 $2" +PART=$(ogDiskToDev "$1" "$2" 2>/dev/null) || exit $(ogRaiseError $OG_ERR_PARTITION "$1 $2" ; echo $?) # Comprobar consistencia del sistema de archivos. echo " " > $OGLOGCOMMAND SIZEFS=$(ogGetFsSize $1 $2) echo "[20] $MSG_HELP_ogCheckFs $PART $SIZEFS (KB) " | tee -a $OGLOGSESSION $OGLOGFILE ogUnmount $1 $2 -ogCheckFs $1 $2 &> $OGLOGCOMMAND || ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $2" +ogCheckFs $1 $2 &> $OGLOGCOMMAND || exit $(ogRaiseError $OG_ERR_PARTITION "ogCheckFs $1 $2"; echo $?) # Comprobamos que la particion se puede montar -ORIG=$(ogMount $1 $2) || ogRaiseError $OG_ERR_PARTITION "$1 $2" - +ORIG=$(ogMount $1 $2) || exit $(ogRaiseError $OG_ERR_PARTITION "$1 $2" ; echo $?) # Borramos ficheros de paginacion y configuracion case "$(ogGetFsType $1 $2)" in @@ -115,7 +112,6 @@ case "$(ogGetFsType $1 $2)" in ;; esac - #Comprobar espacio que requerira la imagen para ser almacenada SIZEDATA=$(df -k | grep $PART | awk '{print $3}') #Aplicar factor de compresion @@ -126,12 +122,10 @@ let SIZEREQUIRED=$SIZEDATA*$ZSYNC/100 [ "$3" == "CACHE" -o "$3" == "cache" ] && SIZEFREE=$(ogGetFreeSize `ogFindCache`) [ "$3" == "REPO" -o "$3" == "repo" ] && SIZEFREE=$(df -k | grep $OGIMG | awk '{print $4}') echo " $MSG_SCRIPTS_CREATE_SIZE $SIZEREQUIRED $SIZEFREE" | tee -a $OGLOGSESSION $OGLOGFILE -[ $SIZEREQUIRED -gt $SIZEFREE ] && ogRaiseError $OG_ERR_CACHESIZE "$3" - +[ $SIZEREQUIRED -gt $SIZEFREE ] && exit $(ogRaiseError $OG_ERR_CACHESIZE "$3"; echo $?) IMGDIR="$(ogGetParentPath "$3" "/$4")" IMGFILE=${IMGDIR[$3]}/$(basename "/$4").$IMGEXT - # Crear la imagen. echo " " > $OGLOGCOMMAND TIME2=$SECONDS @@ -172,9 +166,7 @@ ogUnlock $1 $2 echo " " > $OGLOGCOMMAND # Comprobamos que la imagen esta bien detectacdo que es un sistema de ficheros. echo "[95] $MSG_HELP_ogCheckSyncImage" | tee -a $OGLOGSESSION $OGLOGFILE -ogCheckSyncImage $3 "$4" "img" -[ $? -eq 0 ] || ogRaiseError $OG_ERR_IMAGE "$3 $4 img" - +ogCheckSyncImage $3 "$4" "img" || exit $(ogRaiseError $OG_ERR_IMAGE "$3 $4 img" ; echo $?) #resumen de la operacion IMGSIZE=$(ls -l --block-size=1024 "$IMGFILE" | cut -f5 -d" ") |