gen-tarball.in revision a6c408b691b48ff482de91a1f714dfeb8e196246
1#!/bin/sh
2#
3# This script is used to generate the distribution tarball
4#
5srcdir=@srcdir@
6top_srcdir=@top_srcdir@
7top_dir=`cd $top_srcdir; pwd`
8base_ver=`echo @E2FSPROGS_VERSION@ | sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
9base_e2fsprogs=`basename $top_dir`
10exclude=/tmp/exclude
11GZIP=gzip
12
13#
14# This hack is needed because texi2dvi blows up horribly if there are 
15# any '~' chracters in the directory pathname.  So we kludge around it by
16# using a non-standard directory name for WIP releases.  dpkg-source
17# complains, but life goes on.
18#
19deb_pkgver=`echo @E2FSPROGS_PKGVER@ | sed -e 's/~/-/g'`
20    
21case $1 in
22    debian|ubuntu)
23	SRCROOT="e2fsprogs-$deb_pkgver"
24	rename_tarball="e2fsprogs_@E2FSPROGS_PKGVER@.orig.tar.gz"
25	list=all
26	;;
27    subset)
28	SRCROOT="e2fsprogs-libs-$base_ver"
29	list=subset
30	;;
31   all|*)
32	SRCROOT="e2fsprogs-$base_ver"
33	list=all
34	;;
35esac
36
37mv ../e2fsprogs.spec $top_srcdir/e2fsprogs.spec
38(cd $top_srcdir/.. ; find $base_e2fsprogs \( -name \*~ -o -name \*.orig \
39		-o -name CVS -o -name \*.rej -o -name Makefile.pq \
40		-o -name TAGS -o -name \*.old -o -name SCCS \
41		-o -name changed-files -o -name .#\* -o -name \*.tar.gz \
42		-o -name autom4te.cache \) \
43		-print) | sed -e "s/^$base_e2fsprogs/$SRCROOT/" > $exclude
44sed -e "s;^;$SRCROOT/;" < $srcdir/$list.exclude >> $exclude
45
46(cd $top_srcdir/.. ; rm -f $SRCROOT ; ln -sf e2fsprogs $SRCROOT)
47
48(cd $top_srcdir/.. ; tar -c -h -v -f - -X $exclude $SRCROOT) \
49	 | $GZIP -9 -c > $SRCROOT.tar.gz
50$GZIP -l $SRCROOT.tar.gz
51
52(cd $top_srcdir/.. ; rm -f $SRCROOT)
53mv $top_srcdir/e2fsprogs.spec ../e2fsprogs.spec 
54if test -n "$rename_tarball"; then
55    mv $SRCROOT.tar.gz $rename_tarball
56fi
57