-# Since this is probably a VMWare guest, make sure that the date and
-# time are correct
-ntpdate gate.alldunn.com
+rpmtop=_rpm_top
+
+function DoRPMBuild {
+ echo "*** Setting up RPM build dirs"
+ for dir in SPECS BUILD RPMS SRPMS tmp; do
+ if [ ! -d $rpmtop/$dir ]; then
+ mkdir -p $rpmtop/$dir
+ fi
+ done
+ if [ ! -e $rpmtop/SOURCES ]; then
+ ln -s $PWD $rpmtop/SOURCES
+ fi
+
+ rpmbuild --define "_topdir $PWD/$rpmtop" \
+ --define "_tmppath $PWD/$rpmtop/tmp" \
+ --define "release $RELEASE" \
+ $@
+
+ if [ $? != 0 ]; then
+ return $?
+ fi
+
+ echo "*** Moving RPMs to ."
+ find $rpmtop -name "*.rpm"
+ mv -f `find $rpmtop -name "*.rpm"` .
+
+ echo "*** Cleaning up $rpmtop"
+ rm -rf $rpmtop
+}