Add NetGetJoinableOUs() to libnetapi (incl. example).
[nivanova/samba-autobuild/.git] / release-scripts / create-tarball
1 #!/bin/bash
2
3 TOPDIR="`dirname $0`/.."
4
5 cd $TOPDIR
6
7 echo -n "Please enter branch to cut tarball from: "
8 read branch
9
10 if [ "x$branch" = "x" ]; then
11    echo "You must enter a name!  Exiting...."
12    exit 1
13 fi
14
15 git-checkout $branch
16 if [ $? -ne 0 ]; then
17    echo "Invalid branch name!  Exiting...."
18    exit 2
19 fi
20
21 VER_H=source/include/version.h
22 (cd source && ./autogen.sh)
23
24 if [ ! -f $VER_H ]; then
25    echo "Failed to find $VER_H!  Exiting...."
26    exit 1
27 fi
28
29 version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
30 version="$version-`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`"
31 version=`echo $version | sed 's/\"//g'`
32
33 echo "Creating release tarball for Samba $version"
34
35 /bin/rm -rf ../samba-${version}
36 git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
37
38 pushd ../samba-${version}
39
40 echo "Enter the absolute path to the generated Samba docs directory."
41 echo -n "Just hit return to exclude the docs from the generate tarball: "
42 read docsdir
43
44 if [ "x$docsdir" != "x" ]; then
45    if [ ! -d "$docsdir" ]; then
46       echo "$docsdir does not exist!  Exiting...."
47       exit 1
48    fi
49
50    /bin/rm -rf docs
51    mkdir docs
52    rsync -a $docsdir/ docs/
53
54    cd docs
55    /bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test
56    /bin/mv manpages-3 manpages
57    /bin/mv htmldocs/manpages-3 htmldocs/manpages
58    cd ..
59 fi
60
61 cd ..
62 tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
63 gpg --detach-sign --armor samba-${version}.tar
64 gzip -9 samba-${version}.tar
65
66 popd
67 echo -n "Enter tag name (or hit <enter> to skip): "
68 read tagname
69
70 if [ "x$tagname" != "x" ]; then
71    if [ "x`git-tag -l $tagname`" != "x" ]; then
72       echo -n "Tag exists.  Do you wish to overwrite? (y/N): "
73       read answer
74
75       if [ "x$answer" != "xy" ]; then
76          echo "Tag creation aborted."
77          exit 1
78       fi
79    fi
80
81    git-tag -s ${tagname}
82 fi
83
84 echo "Done!"
85 exit 0