if [ -f locations.include ] ; then . ./locations.include else if [ -f ../locations.include ] ; then . ../locations.include fi fi UPDATES=/tmp/updates.img MNTPOINT=/tmp/rhupdates RHupdates=$TREE/$SITEDIR/RHupdates if [ ! -d $RHupdates ] ; then echo "There is no $RHupdates directory so not making updates.img" if [ -f $TREE/$SITEDIR/base/updates.img ] ; then rm $TREE/$SITEDIR/base/updates.img fi exit fi if [ -s $RHupdates/packages.py ] ; then PACKAGESPY=$RHupdates/packages.py else PACKAGESPY=$TREE/RHupdates/packages.py fi KERNELNAME=`find ../../Updates -follow -name "kernel-smp-2*" | grep -v headers` if [ -z $KERNELNAME ] ; then KERNELNAME=`find ../../RPMS -follow -name "kernel-smp-2*" | grep -v headers` fi KERNELVERSION=`rpm -qp --queryformat "%{VERSION}-%{RELEASE}" $KERNELNAME` grep kernel-module-openafs-${KERNELVERSION} $PACKAGESPY if [ $? = 1 ] ; then echo "You seem to have the wrong version in $PACKAGESPY for " echo "kernel-module-openafs , it should be $KERNELVERSION" exit 1 fi IMAGESIZE=`du -s $RHupdates | cut -f1` if [ $IMAGESIZE -le 65 ] ; then echo "Image was too small so had to make it bigger" IMAGESIZE=65 fi IMAGESIZE=`expr $IMAGESIZE + 1` echo "IMAGESIZE IS $IMAGESIZE" INODES=`find $RHupdates -print | wc -l` INODES=`expr $INODES + 10` echo "INODES is $INODES" dd if=/dev/zero of=$UPDATES bs=1k count=$IMAGESIZE /sbin/mke2fs -F -m 0 -q -N $INODES -b 1024 $UPDATES $IMAGESIZE rm -rf $MNTPOINT mkdir $MNTPOINT mount -o loop,sync -t ext2 $UPDATES $MNTPOINT /bin/rm -r $MNTPOINT/lost+found (cd $RHupdates ; find . | cpio -pvdum $MNTPOINT) df -k $MNTPOINT df -i $MNTPOINT sync sync sync umount $MNTPOINT #CJS we need to verify that what we think we copied to the .img is really there echo "Verifying that the image was made correctly" mount -o loop,ro -t ext2 $UPDATES $MNTPOINT diff -r $MNTPOINT $RHupdates if [ $? != 0 ] ; then echo "The newly created $UPDATES does not match $RHupdates" umount $MNTPOINT exit 1 fi umount $MNTPOINT cp -v $UPDATES ../../base