fail when compressing images isn't working (eg. expected files missing)
authorAdrian Schröter <adrian@suse.de>
Sat, 7 Nov 2009 06:37:54 +0000 (06:37 +0000)
committerAdrian Schröter <adrian@suse.de>
Sat, 7 Nov 2009 06:37:54 +0000 (06:37 +0000)
build

diff --git a/build b/build
index 1391145..774dc36 100755 (executable)
--- a/build
+++ b/build
@@ -1625,24 +1625,24 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                         tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-raw.tar.bz2 \
                           --exclude=$imagename.$imagearch-$imageversion.iso \
                           --exclude=$imagename.$imagearch-$imageversion.raw \
-                          *
+                          * || cleanup_and_exit 1
                         if [ -e $imagename.$imagearch-$imageversion.iso ]; then
                           echo "Copy iso file and create md5..."
                           mv $imagename.$imagearch-$imageversion.iso \
-                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.iso
+                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.iso || cleanup_and_exit 1
                          pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
                           md5sum $imagename.$imagearch-$imageversion$buildnum.iso \
-                                 > "$imagename.$imagearch-$imageversion$buildnum.iso.md5"
+                                 > "$imagename.$imagearch-$imageversion$buildnum.iso.md5" || cleanup_and_exit 1
                           popd > /dev/null
                         fi
                         if [ -e $imagename.$imagearch-$imageversion.raw ]; then
                           echo "Copy raw file and create md5..."
                           mv $imagename.$imagearch-$imageversion.raw \
-                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.raw
+                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.raw || cleanup_and_exit 1
                          pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
                           bzip2 $imagename.$imagearch-$imageversion$buildnum.raw && \
                           md5sum $imagename.$imagearch-$imageversion$buildnum.raw.bz2 \
-                                 > "$imagename.$imagearch-$imageversion$buildnum.raw.bz2.md5"
+                                 > "$imagename.$imagearch-$imageversion$buildnum.raw.bz2.md5" || cleanup_and_exit 1
                           popd > /dev/null
                         fi
                         popd > /dev/null
@@ -1653,15 +1653,15 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                        if [ -e $imagename.$imagearch-$imageversion.xenconfig ] ; then
                           tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xenvmx.tar.bz2 \
                             $imagename.$imagearch-$imageversion.raw \
-                            $imagename.$imagearch-$imageversion.xenconfig                      
+                            $imagename.$imagearch-$imageversion.xenconfig || cleanup_and_exit 1
                        else
                           tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-vmx.tar.bz2 \
                             $imagename.$imagearch-$imageversion.vmx \
-                            $imagename.$imagearch-$imageversion.vmdk
+                            $imagename.$imagearch-$imageversion.vmdk || cleanup_and_exit 1
                          if [ -e $imagename.$imagearch-$imageversion.ovf ] ; then
                             tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-ovf.tar.bz2 \
                               $imagename.$imagearch-$imageversion.ovf \
-                              $imagename.$imagearch-$imageversion-disk*.vmdk
+                              $imagename.$imagearch-$imageversion-disk*.vmdk || cleanup_and_exit 1
                          fi
                        fi
                        popd > /dev/null
@@ -1673,7 +1673,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                           `grep ^kernel $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
                           `grep ^ramdisk $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
                           $imagename.$imagearch-$imageversion.xenconfig \
-                          $imagename.$imagearch-$imageversion
+                          $imagename.$imagearch-$imageversion || cleanup_and_exit 1
                        popd > /dev/null
                         ;;
                     pxe)
@@ -1683,7 +1683,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                           $imagename.$imagearch-$imageversion.config \
                           $imagename.$imagearch-$imageversion.md5 \
                           $imagename.$imagearch-$imageversion.gz \
-                          initrd-*
+                          initrd-* || cleanup_and_exit 1
                        popd > /dev/null
                         ;;
                     iso)
@@ -1691,8 +1691,8 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                         echo "creating md5 sum for iso images... "
                        for i in *.iso; do
                           pushd $BUILD_ROOT/$TOPDIR/KIWI/ > /dev/null
-                         mv $BUILD_ROOT/$TOPDIR/KIWI-iso/$i ${i%.iso}$buildnum.iso
-                         md5sum ${i%.iso}$buildnum.iso > ${i%.iso}$buildnum.iso.md5
+                         mv $BUILD_ROOT/$TOPDIR/KIWI-iso/$i ${i%.iso}$buildnum.iso || cleanup_and_exit 1
+                         md5sum ${i%.iso}$buildnum.iso > ${i%.iso}$buildnum.iso.md5 || cleanup_and_exit 1
                          popd > /dev/null
                         done
                        popd > /dev/null
@@ -1701,7 +1701,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
                         pushd $BUILD_ROOT/$TOPDIR/KIWI-$imgtype > /dev/null
                         echo "compressing unkown images... "
                         tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-$imgtype.tar.bz2 \
-                          *
+                          * || cleanup_and_exit 1
                        popd > /dev/null
                         ;;
                 esac