aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorStephen Tweedie <sct@redhat.com>2002-01-10 17:56:07 +0000
committerStephen Tweedie <sct@redhat.com>2002-01-10 17:56:07 +0000
commitdad36d029bc3df8c764a1fe5a09fb7025a397f97 (patch)
tree86733364f2e304b9c704408cbec73f774c0fedf2 /contrib
parentf10ff6429b89f3d099dbd7e76c5b7049854a1493 (diff)
downloadandroid_external_e2fsprogs-dad36d029bc3df8c764a1fe5a09fb7025a397f97.tar.gz
android_external_e2fsprogs-dad36d029bc3df8c764a1fe5a09fb7025a397f97.tar.bz2
android_external_e2fsprogs-dad36d029bc3df8c764a1fe5a09fb7025a397f97.zip
Fix build-rpm script to work a bit more safely.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/build-rpm17
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