move huge block of kiwi code to separate file
authorLudwig Nussel <ludwig.nussel@suse.de>
Wed, 9 Dec 2009 13:59:27 +0000 (14:59 +0100)
committerLudwig Nussel <ludwig.nussel@suse.de>
Wed, 9 Dec 2009 16:41:49 +0000 (17:41 +0100)
build
build_kiwi.sh [new file with mode: 0644]

diff --git a/build b/build
index 8c3cac5..3aed08f 100755 (executable)
--- a/build
+++ b/build
@@ -1544,210 +1544,8 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     fi
 
     if test "$BUILDTYPE" = kiwi ; then
-       imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE imagetype)
-       imagename=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE filename)
-       imageversion=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE version)
-       # prepare rpms as source and createrepo on the repositories
-       if test -d $BUILD_ROOT/$TOPDIR/SOURCES/repos ; then
-           (
-           ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
-           cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
-           for r in */* ; do
-               test -L $r && continue
-               test -d $r || continue
-               repo="$TOPDIR/SOURCES/repos/$r/"
-               # create compatibility link for old kiwi versions
-               rc="${r//:/:/}"
-               if test "$rc" != "$r" ; then
-                   rl="${rc//[^\/]}"
-                   rl="${rl//?/../}"
-                   mkdir -p "${rc%/*}"
-                   ln -s $rl$r "${rc%/*}/${rc##*/}"
-                   repo="$TOPDIR/SOURCES/repos/${rc%/*}/${rc##*/}/"
-               fi
-               if test "$imagetype" != product ; then
-                   echo "creating repodata for $repo"
-                   chroot $BUILD_ROOT createrepo "$repo"
-               fi
-           done
-           )
-       fi
-       # unpack root tar
-       for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
-           test -f $t || continue
-           mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
-           chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
-       done
-       # fix script permissions
-       chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/*.sh 2>/dev/null
-       # unpack tar files in image directories
-       if test -d $BUILD_ROOT/$TOPDIR/SOURCES/images ; then
-           (
-           cd $BUILD_ROOT/$TOPDIR/SOURCES/images
-           for r in */* ; do
-               test -L $r && continue
-               test -d $r || continue
-               for t in $r/root.tar* ; do
-                   test -f $t || continue
-                   mkdir -p $r/root
-                   chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
-               done
-               # fix script permissions
-               chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
-               # create compatibility link for old kiwi versions
-               rc="${r//:/:/}"
-               if test "$rc" != "$r" ; then
-                   rl="${rc//[^\/]}"
-                   rl="${rl//?/../}"
-                   mkdir -p "${rc%/*}"
-                   ln -s $rl$r "${rc%/*}/${rc##*/}"
-               fi
-           done
-           )
-       fi
-       rm -f $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
-       ln -s $SPECFILE $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
-       chroot $BUILD_ROOT su -c "kiwi --version" -
-       if test "$imagetype" = product ; then
-           echo "running kiwi --create-instsource..."
-           # runs always as abuild user
-           mkdir -p "$BUILD_ROOT/$TOPDIR/KIWIROOT"
-           chroot "$BUILD_ROOT" chown -R abuild.abuild "$TOPDIR"
-           # --instsource-local is only needed for openSUSE 11.1 and SLE 11 SP0 kiwi.
-           chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v -v --logfile terminal -p $TOPDIR/SOURCES --instsource-local --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
-### This block is obsolete with current kiwi versions, only needed for kiwi 3.01 version
-#            for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
-#                test -d "$i" || continue
-#                n="${i##*/}"
-#                test "$n" = scripts && continue
-#                test "$n" != "${n%0}" && continue
-#                chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$n $TOPDIR/KIWI/$n.iso" - $BUILD_USER
-#            done
-
-           # move created product to correct destination
-           for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
-               test -e "$i" || continue
-               f=${i##*/}
-               case $f in
-                   *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
-                   scripts) ;;
-                   *0) ;;
-                   *) test -d $i && mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
-               esac
-           done
-       else
-           BUILD_SUCCEEDED=true
-           if [ -z "$RUNNING_IN_VM" ]; then
-               # NOTE: this must be done with the outer system, because it loads the dm-mod kernel modules, which needs to fit to the kernel.
-               echo "starting device mapper for kiwi..."
-               [ -x /etc/init.d/boot.device-mapper ] && /etc/init.d/boot.device-mapper start
-           fi
-           for imgtype in $imagetype ; do
-               echo "running kiwi --prepare for $imgtype..."
-               # Do not use $BUILD_USER here, since we always need root permissions
-               if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - root < /dev/null ; then
-                   echo "running kiwi --create for $imgtype..."
-                   mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
-                   chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype" - root < /dev/null || cleanup_and_exit 1
-               else
-                   cleanup_and_exit 1
-               fi
-           done
-
-           # create tar.gz of images, in case it makes sense
-           imagearch=`uname -m`
-           buildnum=""
-             if test -n "$RELEASE"; then
-               buildnum="-Build$RELEASE"
-           fi
-           for imgtype in $imagetype ; do
-               case "$imgtype" in
-                   oem)
-                               pushd $BUILD_ROOT/$TOPDIR/KIWI-oem > /dev/null
-                       echo "compressing images... "
-                       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 || cleanup_and_exit 1
-                                 pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
-                         md5sum $imagename.$imagearch-$imageversion$buildnum.iso \
-                                > "$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 || 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" || cleanup_and_exit 1
-                         popd > /dev/null
-                       fi
-                       popd > /dev/null
-                       ;;
-                   vmx)
-                       pushd $BUILD_ROOT/$TOPDIR/KIWI-vmx > /dev/null
-                       echo "compressing images... "
-                               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 || 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 || 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 || cleanup_and_exit 1
-                             fi
-                       fi
-                               popd > /dev/null
-                       ;;
-                   xen)
-                       pushd $BUILD_ROOT/$TOPDIR/KIWI-xen > /dev/null
-                       echo "compressing images... "
-                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xen.tar.bz2 \
-                         `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 || cleanup_and_exit 1
-                               popd > /dev/null
-                       ;;
-                   pxe)
-                       pushd $BUILD_ROOT/$TOPDIR/KIWI-pxe > /dev/null
-                       echo "compressing images... "
-                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-pxe.tar.bz2 \
-                         $imagename.$imagearch-$imageversion* \
-                         initrd-* || cleanup_and_exit 1
-                               popd > /dev/null
-                       ;;
-                   iso)
-                       pushd $BUILD_ROOT/$TOPDIR/KIWI-iso > /dev/null
-                       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 || 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
-                       ;;
-                   *)
-                       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
-           done
-       fi
+       . $BUILD_DIR/build_kiwi.sh
+       run_kiwi
     fi
 
     test "$BUILD_SUCCEEDED" = true || cleanup_and_exit 1
diff --git a/build_kiwi.sh b/build_kiwi.sh
new file mode 100644 (file)
index 0000000..5336ad5
--- /dev/null
@@ -0,0 +1,208 @@
+#!/bin/bash
+run_kiwi()
+{
+    imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE imagetype)
+    imagename=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE filename)
+    imageversion=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE version)
+    # prepare rpms as source and createrepo on the repositories
+    if test -d $BUILD_ROOT/$TOPDIR/SOURCES/repos ; then
+       (
+       ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
+       cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
+       for r in */* ; do
+           test -L $r && continue
+           test -d $r || continue
+           repo="$TOPDIR/SOURCES/repos/$r/"
+           # create compatibility link for old kiwi versions
+           rc="${r//:/:/}"
+           if test "$rc" != "$r" ; then
+               rl="${rc//[^\/]}"
+               rl="${rl//?/../}"
+               mkdir -p "${rc%/*}"
+               ln -s $rl$r "${rc%/*}/${rc##*/}"
+               repo="$TOPDIR/SOURCES/repos/${rc%/*}/${rc##*/}/"
+           fi
+           if test "$imagetype" != product ; then
+               echo "creating repodata for $repo"
+               chroot $BUILD_ROOT createrepo "$repo"
+           fi
+       done
+       )
+    fi
+    # unpack root tar
+    for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
+       test -f $t || continue
+       mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
+       chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
+    done
+    # fix script permissions
+    chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/*.sh 2>/dev/null
+    # unpack tar files in image directories
+    if test -d $BUILD_ROOT/$TOPDIR/SOURCES/images ; then
+       (
+       cd $BUILD_ROOT/$TOPDIR/SOURCES/images
+       for r in */* ; do
+           test -L $r && continue
+           test -d $r || continue
+           for t in $r/root.tar* ; do
+               test -f $t || continue
+               mkdir -p $r/root
+               chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
+           done
+           # fix script permissions
+           chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
+           # create compatibility link for old kiwi versions
+           rc="${r//:/:/}"
+           if test "$rc" != "$r" ; then
+               rl="${rc//[^\/]}"
+               rl="${rl//?/../}"
+               mkdir -p "${rc%/*}"
+               ln -s $rl$r "${rc%/*}/${rc##*/}"
+           fi
+       done
+       )
+    fi
+    rm -f $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
+    ln -s $SPECFILE $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
+    chroot $BUILD_ROOT su -c "kiwi --version" -
+    if test "$imagetype" = product ; then
+       echo "running kiwi --create-instsource..."
+       # runs always as abuild user
+       mkdir -p "$BUILD_ROOT/$TOPDIR/KIWIROOT"
+       chroot "$BUILD_ROOT" chown -R abuild.abuild "$TOPDIR"
+       # --instsource-local is only needed for openSUSE 11.1 and SLE 11 SP0 kiwi.
+       chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v -v --logfile terminal -p $TOPDIR/SOURCES --instsource-local --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
+### This block is obsolete with current kiwi versions, only needed for kiwi 3.01 version
+#            for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
+#                test -d "$i" || continue
+#                n="${i##*/}"
+#                test "$n" = scripts && continue
+#                test "$n" != "${n%0}" && continue
+#                chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$n $TOPDIR/KIWI/$n.iso" - $BUILD_USER
+#            done
+
+       # move created product to correct destination
+       for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
+           test -e "$i" || continue
+           f=${i##*/}
+           case $f in
+               *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
+               scripts) ;;
+               *0) ;;
+               *) test -d $i && mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
+           esac
+       done
+    else
+       BUILD_SUCCEEDED=true
+       if [ -z "$RUNNING_IN_VM" ]; then
+           # NOTE: this must be done with the outer system, because it loads the dm-mod kernel modules, which needs to fit to the kernel.
+           echo "starting device mapper for kiwi..."
+           [ -x /etc/init.d/boot.device-mapper ] && /etc/init.d/boot.device-mapper start
+       fi
+       for imgtype in $imagetype ; do
+           echo "running kiwi --prepare for $imgtype..."
+           # Do not use $BUILD_USER here, since we always need root permissions
+           if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - root < /dev/null ; then
+               echo "running kiwi --create for $imgtype..."
+               mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
+               chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype" - root < /dev/null || cleanup_and_exit 1
+           else
+               cleanup_and_exit 1
+           fi
+       done
+
+       # create tar.gz of images, in case it makes sense
+       imagearch=`uname -m`
+       buildnum=""
+         if test -n "$RELEASE"; then
+           buildnum="-Build$RELEASE"
+       fi
+       for imgtype in $imagetype ; do
+           case "$imgtype" in
+               oem)
+                           pushd $BUILD_ROOT/$TOPDIR/KIWI-oem > /dev/null
+                   echo "compressing images... "
+                   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 || cleanup_and_exit 1
+                             pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
+                     md5sum $imagename.$imagearch-$imageversion$buildnum.iso \
+                            > "$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 || 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" || cleanup_and_exit 1
+                     popd > /dev/null
+                   fi
+                   popd > /dev/null
+                   ;;
+               vmx)
+                   pushd $BUILD_ROOT/$TOPDIR/KIWI-vmx > /dev/null
+                   echo "compressing images... "
+                           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 || 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 || 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 || cleanup_and_exit 1
+                         fi
+                   fi
+                           popd > /dev/null
+                   ;;
+               xen)
+                   pushd $BUILD_ROOT/$TOPDIR/KIWI-xen > /dev/null
+                   echo "compressing images... "
+                   tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xen.tar.bz2 \
+                     `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 || cleanup_and_exit 1
+                           popd > /dev/null
+                   ;;
+               pxe)
+                   pushd $BUILD_ROOT/$TOPDIR/KIWI-pxe > /dev/null
+                   echo "compressing images... "
+                   tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-pxe.tar.bz2 \
+                     $imagename.$imagearch-$imageversion* \
+                     initrd-* || cleanup_and_exit 1
+                           popd > /dev/null
+                   ;;
+               iso)
+                   pushd $BUILD_ROOT/$TOPDIR/KIWI-iso > /dev/null
+                   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 || 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
+                   ;;
+               *)
+                   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
+       done
+    fi
+}