MYPWD=`pwd`
ARCH=x86_64
OLDINITRDDIR=initrd.orig.dir
PATCHES=initrdpatches
FROM=images/$ARCH
NEWBOOTISO=$FROM/newbootiso/isolinux
for WHICH in pxeboot
do
	if [ -d $OLDINITRDDIR ] ; then
   		/bin/rm -r $OLDINITRDDIR
	fi
	mkdir $OLDINITRDDIR
	cd $OLDINITRDDIR
	cpio -ivdum  < $MYPWD/$FROM/$WHICH/initrd.img
        cd $MYPWD/$FROM/$PATCHES
	# copy changes from $PATCHES and overwrite them in $OLDINITRDDIR
	find . -print | cpio -pvdum $MYPWD/$OLDINITRDDIR
	cd $MYPWD/$OLDINITRDDIR
	find . |cpio -c -o |gzip -9 > $MYPWD/$FROM/initrd.img.$WHICH
done

