Avoid to segfault if we only have the realm.
[metze/old/v3-2-winbind-ndr.git] / make-tarball.sh
1 #!/bin/sh
2
3 ## A simple script to build a tarball of the current CVS tree.
4 ## You either need to include the using_samba cvs module in the
5 ## parent directory or tell the script where to find it 
6 ##
7 ## Usgae:  ./make-tarball.sh [nodocs]
8
9 NODOCS=0
10 if [ x"$1" = x"nodocs" ] ; then
11         NODOCS=1
12         echo Not including docs.
13 fi
14
15 DOCSDIR=../samba-docs/
16 USING_SAMBA=../using_samba/
17 SRCDIR=`pwd`
18
19 if [ $NODOCS -eq 0 ]; then
20         if [ ! -d $USING_SAMBA ]; then
21         
22                 echo Cannot find "Using Samba" directory \(assuming $USING_SAMBA\).  
23                 echo Please set the USING_SAMBA variable in this script to the correct
24                 echo location.  The html files are available in the using_samba CVS 
25                 echo module on cvs.samba.org.  See http://cvs.samba.org/ for details 
26                 echo about anonymous CVS access.  Exiting now....
27         
28                 exit 1
29         
30         fi
31         
32         if [ ! -d $DOCSDIR ]; then
33         
34                 echo Cannot find samba-docs \(assuming $DOCSDIR\).
35                 echo Please set the DOCSDIR variable in this script 
36                 echo to the correct path.
37         
38                 exit 1
39         
40         fi
41 fi
42
43 ( cd source ; sh script/mkversion.sh )
44 VERSION=`grep SAMBA_VERSION_OFFICIAL_STRING source/include/version.h | cut -d\" -f2 | sed 's/ /_/g'`
45 TARBALLDIR=/tmp/samba-$VERSION
46
47 echo Creating the tarball source directory in $TARBALLDIR
48
49 /bin/rm -rf $TARBALLDIR
50 /bin/rm -f samba-$VERSION.tar
51
52 mkdir $TARBALLDIR
53 rsync -aC ./ $TARBALLDIR
54 /bin/rm -rf $TARBALLDIR/docs/*
55 if [ $NODOCS -eq 0 ]; then
56         rsync -aC $DOCSDIR/ $TARBALLDIR/docs/ 
57         rsync -aC $USING_SAMBA $TARBALLDIR/docs/htmldocs/
58 fi
59
60 echo Creating packaging scripts...
61 ( cd $TARBALLDIR/packaging; sh bin/update-pkginfo $VERSION 1 )
62
63 echo Creating source/configure...
64 ( cd $TARBALLDIR/source; ./autogen.sh )
65
66 echo Making tarball samba-$VERSION.tar in current directory...
67 ( cd `dirname $TARBALLDIR`; tar cf $SRCDIR/samba-$VERSION.tar samba-$VERSION )