1#!/bin/sh 2 3# Build an e2fsprogs RPM from cvs 4 5pwd=`pwd` 6currdir=`basename $pwd` 7pkgname=`grep Name: e2fsprogs.spec | awk '{print $2;}'` 8pkgvers=`grep Version: e2fsprogs.spec | awk '{print $2;}'` 9builddir=${pkgname}-${pkgvers} 10 11cd .. 12tmpdir=`mktemp -d rpmtmp.XXXXXX` 13 14# We need to build a tarball for the SRPM using $builddir as the 15# directory name (since that's what RPM will expect it to unpack 16# into). That may require a symlink. 17 18# Make a recursive-symlink copy of the source dir 19cp -sR `pwd`/$currdir $tmpdir/$builddir || exit 1 20 21# Remove any build files from the temporary tarball directory 22[ -f $tmpdir/$builddir/Makefile ] && make -C $tmpdir/$builddir distclean 23 24EXCLUDE="--exclude .hg* --exclude .pc*" 25(cd $tmpdir && tar czfh ${builddir}.tar.gz $EXCLUDE $builddir) 26 27[ "`rpmbuild --version 2> /dev/null`" ] && RPM=rpmbuild || RPM=rpm 28$RPM --define "_sourcedir `pwd`/$tmpdir" -ba $currdir/e2fsprogs.spec 29 30ret=$? 31rm -rf $tmpdir 32exit $? 33 34 35