#!/bin/sh
#builds a set of ipkgs from the build tree and updates index

#IPKGDIR=/home/aleph1/armlinux/CDs/PFN/ipkg
export IPKGDIR=/cdimages/mirror/psilinux/PFN
export BUILDDIR=/home/aleph1/armlinux/boards/psion/5mx/PFN/build


cd $BUILDDIR
for file in *; do
  echo $BUILDDIR/$file
  export file
  (cd $IPKGDIR; ipkg-build $BUILDDIR/$file; )
#  (cat $BUILDDIR/$file/CONTROL/control >> $IPKGDIR/Packages; 
#   echo "Filename: $file_arm.ipk" >> $IPKGDIR/Packages
#   echo "MD5Sum: `md5sum $IPKGDIR/$file_arm.ipk | cut --fields=1 --delimiter=\" \"`" >> $IPKGDIR/Packages;
#   echo "Size: `ls --size --block-size=1 $IPKGDIR/$file_arm.ipk | cut --fields=1 --delimiter=\" \"`" >> $IPKGDIR/Packages; 
#   echo -e "\n" >> $IPKGDIR/Packages;)
done

#then generate Packages file
./makeindex
#rm $IPKGDIR/Packages
#ipkg-make-index $IPKGDIR > $IPKGDIR/Packages