# produce bootcd ISO image
MEDIA_NAME=`media_name`
MEDIA_NAMES=()
DISTROMATIC_OPT=""

for i in $LIVECD_TARGETS; do
   . $TARGETDIR/platforms/$i/settings.inc
   CURR_MEDIA_NAME=`PLATFORM=$i media_name`
   MEDIA_NAMES=(${MEDIA_NAMES[*]} $CURR_MEDIA_NAME)

   [ "$FORCE" = "1" -o ! -e "$LOCALSTATEDIR/$CURR_MEDIA_NAME" ] && {
      makedist $MAKEDIST_TARGET PLATFORM=$i FORCE=1 DISTROMATIC=$DISTROMATIC_OPT
      DISTROMATIC_OPT="off"
   }
done

. $TARGETDIR/platforms/$PLATFORM/settings.inc

echo "Creating bootable livecd..."
[ "$MOUNTDIR" ] && rm -rf $MOUNTDIR/*
[ "$MOUNTDIR2" ] && rm -rf $MOUNTDIR2/*

#[ "$EXTRA_PACKAGES" ] && {
#   echo "- installing repository with extra packages"
#   add_packages_to_repository $MOUNTDIR/repositories/extras "$EXTRA_PACKAGES"
#}

for i in ${MEDIA_NAMES[*]}; do
   echo "- installing $i"
   cp $LOCALSTATEDIR/$i $MOUNTDIR2
done