3 # enable xtrace output if requested
4 if [ -n ${ENABLE_XTRACE:-''} ]; then
8 # Build an e2fsprogs RPM from cvs
11 currdir=`basename $pwd`
12 pkgname=`grep Name: e2fsprogs.spec | awk '{print $2;}'`
13 pkgvers=`grep Version: e2fsprogs.spec | awk '{print $2;}'`
14 builddir=${pkgname}-${pkgvers}
16 # ensure that $TMP is set to something
20 tmpdir=`mktemp -d ${RPM_TMPDIR:-$TMP}/rpmtmp.XXXXXX`
22 # We need to build a tarball for the SRPM using $builddir as the
23 # directory name (since that's what RPM will expect it to unpack
24 # into). That may require a symlink.
26 # Make a recursive-symlink copy of the source dir
27 cp -sR `pwd`/$currdir $tmpdir/$builddir || exit 1
29 # Remove any build files from the temporary tarball directory
30 [ -f $tmpdir/$builddir/Makefile ] && make -C $tmpdir/$builddir distclean
32 EXCLUDE="--exclude .hg* --exclude .pc* --exclude .git*"
33 (cd $tmpdir && tar czfh ${builddir}.tar.gz $EXCLUDE $builddir)
35 [ "`rpmbuild --version 2> /dev/null`" ] && RPM=rpmbuild || RPM=rpm
37 # which distro and release
38 DISTRO=$(lsb_release -is)
39 RELEASE=$(lsb_release -rs)
40 # now the hacks in case either is empty
41 if [ -z "$DISTRO" ]; then
42 echo "You really ought to install the lsb_release binary for this distro"
43 if grep "Fedora " /etc/issue; then
46 if grep "SUSE Linux Enterprise Server " /etc/issue; then
50 if [ -z "$DISTRO" ]; then
51 echo "Could not determine the distribution. Please install the lsb_release binary"
54 if [ -z "$RELEASE" ]; then
55 echo "You really ought to install the lsb_release binary for this distro"
58 RELEASE=$(grep Fedora /etc/issue | sed -e 's/Fedora release //' -e 's/ .*//')
61 RELEASE=$(grep SUSE /etc/issue | sed -e 's/SUSE Linux Enterprise Server //' -e 's/ .*//')
65 if [ -z "$RELEASE" ]; then
66 echo "Could not determine the release. Please install the lsb_release binary"
69 case "$DISTRO-$RELEASE" in
70 RedHatEnterpriseServer-6*) DISTRO=RHEL; RELEASE=6;;
71 CentOS-6*) DISTRO=RHEL; RELEASE=6;;
72 Fedora-1[234]) DISTRO=RHEL; RELEASE=6;; # use the same .spec for now
75 SPECFILE="$currdir/e2fsprogs-${DISTRO// /_}-$RELEASE.spec"
76 if [ ! -f "$SPECFILE" ]; then
77 SPECFILE="$currdir/e2fsprogs.spec"
79 $RPM --define "_sourcedir $tmpdir" \
80 --define "_topdir ${RPM_TOPDIR:-$(rpm -E %_topdir)}" \
81 --define "_tmpdir ${RPM_TMPDIR:-$TMP}" \
82 --define "extra_config_flags ${EXTRA_CONFIG_FLAGS:-''}" \