Add release scripts for talloc and tdb
[ira/wip.git] / lib / tdb / release-script.sh
1 #!/bin/bash
2
3 if [ "$1" = "" ]; then
4     echo "Please provide version string, eg: 1.2.0"
5     exit 1
6 fi
7
8 if [ ! -d "lib/tdb" ]; then
9     echo "Run this script from the samba base directory."
10     exit 1
11 fi
12
13 curbranch=`git-branch |grep "^*" | tr -d "* "`
14
15 version=$1
16 strver=`echo ${version} | tr "." "-"`
17
18 # Checkout the release tag
19 git branch -f tdb-release-script-${strver} tdb-${strver}
20 if [ ! "$?" = "0" ];  then
21     echo "Unable to checkout tdb-${strver} release"
22     exit 1
23 fi
24
25 git checkout tdb-release-script-${strver}
26
27 # Test configure agrees with us
28 confver=`grep "^AC_INIT" lib/tdb/configure.ac | tr -d "AC_INIT(tdb, " | tr -d ")"`
29 if [ ! "$confver" = "$version" ]; then
30     echo "Wrong version, requested release for ${version}, found ${confver}"
31     exit 1
32 fi
33
34 # Now build tarball
35 cp -a lib/tdb tdb-${version}
36 cp -a lib/replace tdb-${version}/libreplace
37 pushd tdb-${version}
38 ./autogen.sh
39 popd
40 tar cvzf tdb-${version}.tar.gz tdb-${version}
41 rm -fr tdb-${version}
42
43 #Clean up
44 git checkout $curbranch
45 git branch -d tdb-release-script-${strver}