diff options
author | Stephen Tweedie <sct@redhat.com> | 2002-01-10 17:56:07 +0000 |
---|---|---|
committer | Stephen Tweedie <sct@redhat.com> | 2002-01-10 17:56:07 +0000 |
commit | dad36d029bc3df8c764a1fe5a09fb7025a397f97 (patch) | |
tree | 86733364f2e304b9c704408cbec73f774c0fedf2 /contrib | |
parent | f10ff6429b89f3d099dbd7e76c5b7049854a1493 (diff) | |
download | e2fsprogs-dad36d029bc3df8c764a1fe5a09fb7025a397f97.tar.gz |
Fix build-rpm script to work a bit more safely.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/build-rpm | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/contrib/build-rpm b/contrib/build-rpm index fcafce31..4e5da7d1 100644 --- a/contrib/build-rpm +++ b/contrib/build-rpm @@ -9,23 +9,20 @@ pkgvers=`grep Version: e2fsprogs.spec | awk '{print $2;}'` builddir=${pkgname}-${pkgvers} cd .. +tmpdir=`mktemp -d rpmtmp.XXXXXX` # We need to build a tarball for the SRPM using $builddir as the # directory name (since that's what RPM will expect it to unpack # into). That may require a symlink. -if [ -L $builddir ] ; then - rm -f $builddir || exit 1 -elif [ -d $builddir ] ; then - rm -rf $builddir || exit 1 -fi - # Make a recursive-symlink copy of the source dir -cp -sR `pwd`/$currdir $builddir || exit 1 +cp -sR `pwd`/$currdir $tmpdir/$builddir || exit 1 # Remove any build files from the temporary tarball directory -[ -f $builddir/Makefile ] && make -C $builddir distclean +[ -f $tmpdir/$builddir/Makefile ] && make -C $tmpdir/$builddir distclean + +(cd $tmpdir && tar czfh ${builddir}.tar.gz $builddir) -tar czfh ${builddir}.tar.gz $builddir +rpm --define "_sourcedir `pwd`/$tmpdir" -ba $currdir/e2fsprogs.spec || exit $? +rm -rf $tmpdir -rpm --define "_sourcedir `pwd`" -ba $currdir/e2fsprogs.spec |