summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclient/engine/Image.lib13
-rwxr-xr-xrepoman/bin/checkrepo6
2 files changed, 11 insertions, 8 deletions
diff --git a/client/engine/Image.lib b/client/engine/Image.lib
index 71c1e299..f9089404 100755
--- a/client/engine/Image.lib
+++ b/client/engine/Image.lib
@@ -273,9 +273,11 @@ ogLockImage "$2" "$3.$IMGTYPE" || return $?
trap "ogUnlockDisk $1; ogUnlockImage "$3" "$4.$IMGTYPE"; rm -f $IMGFILE" 1 2 3 6 9
eval $PROGRAM
-# Controlar salida de error y desbloquear partición.
+# Controlar salida de error, crear fichero de información y desbloquear partición.
ERRCODE=$?
-if [ $ERRCODE != 0 ]; then
+if [ $ERRCODE == 0 ]; then
+ echo "$(ogGetImageInfo $IMGFILE):$(ogGetHostname)" > $IMGFILE.info
+else
ogRaiseError $OG_ERR_IMAGE "$1 $2 $IMGFILE"
rm -f "$IMGFILE"
fi
@@ -286,7 +288,6 @@ return $ERRCODE
}
-
#/**
# ogCreateImage int_ndisk int_npartition str_repo path_image [str_tools] [str_compressionlevel]
#@brief Crea una imagen a partir de una partición.
@@ -357,9 +358,11 @@ ogLockImage "$3" "$4.$IMGTYPE" || return $?
trap "ogUnlock $1 $2; ogUnlockImage "$3" "$4.$IMGTYPE"; rm -f $IMGFILE" 1 2 3 6 9
eval $PROGRAM
-# Controlar salida de error y desbloquear partición.
+# Controlar salida de error, crear fichero de información y desbloquear partición.
ERRCODE=$?
-if [ $ERRCODE != 0 ]; then
+if [ $ERRCODE == 0 ]; then
+ echo "$(ogGetImageInfo $IMGFILE):$(ogGetHostname)" > $IMGFILE.info
+else
ogRaiseError $OG_ERR_IMAGE "$1 $2 $IMGFILE"
rm -f "$IMGFILE"
fi
diff --git a/repoman/bin/checkrepo b/repoman/bin/checkrepo
index c2628ba7..40643931 100755
--- a/repoman/bin/checkrepo
+++ b/repoman/bin/checkrepo
@@ -48,7 +48,7 @@ function addToJson() {
"clonator":"${CLONATOR,,}",
"compressor":"${COMPRESSOR,,}",
"filesystem":"${FSTYPE^^}",
- "datasize":"$DATASIZE"
+ "datasize":${DATASIZE:-0}
}
EOT
)
@@ -64,7 +64,7 @@ EOT
# Check if it needs to update or insert data.
if [ -n "$IMGIND" ]; then
# Update if image data changes and info file exists.
- [ $# -gt 2 -a "$(jq ".check=$JSON | .check==.images[$IMGIND]" $INFOFILE)" == "false" ] && jq ".images[$IMGIND]=$JSON" $INFOFILE | sponge $INFOFILE
+ [ -n "$3" -a "$(jq ".check=$JSON | .check==.images[$IMGIND]" $INFOFILE)" == "false" ] && jq ".images[$IMGIND]=$JSON" $INFOFILE | sponge $INFOFILE
else
# Append a new entry.
jq ".images |= (. + [$JSON])" $INFOFILE | sponge $INFOFILE
@@ -153,7 +153,7 @@ function checkfiles() {
# Retrieve image creation data and delete temporary file.
INFO="$IMG.info"
[ -e "$INFO" -a "$INFO" -ot "$IMG" ] && rm -f "$INFO" && echo "Warning: Deleted outdated file $INFO"
- [ -r "$INFO" ] && DATA=$(tr ':' ' ' < "$INFO")
+ [ -r "$INFO" ] && DATA=$(cat "$INFO")
# Add data to configuration file (name, type and data) and remove image info file.
IMG=${IMG#$IMAGESDIR/}
addToJson "${IMG%.*}" "${IMG##*.}" "$DATA" && rm -f "$INFO"