summaryrefslogtreecommitdiffstats
path: root/release-scripts/create-tarball
blob: a689e693afb1f3328db0df864eecdc535c336e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash

TOPDIR="`dirname $0`/.."

cd $TOPDIR

echo -n "Please enter branch to cut tarball from: "
read branch

if [ "x$branch" = "x" ]; then
   echo "You must enter a name!  Exiting...."
   exit 1
fi

git-checkout $branch
if [ $? -ne 0 ]; then
   echo "Invalid branch name!  Exiting...."
   exit 2
fi

VER_H=source/include/version.h
(cd source && ./script/mkversion.sh)

if [ ! -f $VER_H ]; then
   echo "Failed to find $VER_H!  Exiting...."
   exit 1
fi

version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`
if [ -n "$vendor_version" ]; then
    version="$version-$vendor_version"
fi
version=`echo $version | sed 's/\"//g'`

echo "Creating release tarball for Samba $version"

/bin/rm -rf ../samba-${version}
git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)

pushd ../samba-${version}

echo "Enter the absolute path to the generated Samba docs directory."
echo -n "Just hit return to exclude the docs from the generate tarball: "
read docsdir

if [ "x$docsdir" != "x" ]; then
   if [ ! -d "$docsdir" ]; then
      echo "$docsdir does not exist!  Exiting...."
      exit 1
   fi

   /bin/rm -rf docs
   mkdir docs
   rsync -a --exclude=.svn $docsdir/ docs/

   cd docs
   /bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test
   /bin/mv manpages-3 manpages
   /bin/mv htmldocs/manpages-3 htmldocs/manpages
   cd ..
fi

cd source
./autogen.sh
cd ..

cd ..
tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
gpg --detach-sign --armor samba-${version}.tar
gzip -9 samba-${version}.tar

popd
echo -n "Enter tag name (or hit <enter> to skip): "
read tagname

if [ "x$tagname" != "x" ]; then
   if [ "x`git-tag -l $tagname`" != "x" ]; then
      echo -n "Tag exists.  Do you wish to overwrite? (y/N): "
      read answer

      if [ "x$answer" != "xy" ]; then
      	 echo "Tag creation aborted."
	 exit 1
      fi
   fi

   echo -n "Enter the keyid:"
   read keyid
   if [ x"$keyid" = x"" ];then
      echo "no keyid"
      exit 1
   fi
   git-tag -u $keyid ${tagname}
fi

echo "Done!"
exit 0