9 TOPDIR="`dirname $0`/.."
10 VER_H="${TOPDIR}/source3/include/version.h"
17 if [ ${_error} -eq 0 ]; then
21 echo "FAILURE: ${_msg}"
31 echo "Usage $0 [options]"
32 echo " --help Print command usage"
33 echo " --branch <name> Specify the branch to to create the archive file from"
34 echo " --copy-docs <dir> Copy documentation from <dir> rather than building"
35 echo " --tag <name> Tag name for release"
36 echo " --keyid <email> The GnuPG key ID used to sign the release tag"
41 ## Parse the command line options
95 if [ -z "${OPT_BRANCH}" ]; then
96 echo "You must specify a branch name!"
103 ## Build the dopcumentation (may be a no-op)
108 if [ -n "${OPT_DOCSDIR}" ]; then
109 if [ ! -d "${OPT_DOCSDIR}" ]; then
110 exitOnError 1 "${OPT_DOCSDIR} does not exist. Please specify the absolute path."
114 exitOnError $? "Failed to create docs directory"
116 rsync -av "${OPT_DOCSDIR}"/ docs/
117 exitOnError $? "Failed top copy docs from ${OPT_DOCSDIR}"
122 echo "Building documentation. This may take a while. Log file in /tmp/docs-build.log.$$"
124 ${TOPDIR}/release-scripts/build-docs 2> /tmp/docs-build.log.$$
131 ## Create a release tag
133 function createReleaseTag
135 if [ -z "${OPT_TAG}" ]; then
136 echo "Tagging disabled"
140 if [ "x`git tag -l ${OPT_TAG}`" != "x" ]; then
141 echo -n "Tag exists. Do you wish to overwrite? (y/N): "
144 if [ "x$answer" != "xy" ]; then
145 echo "Tag creation aborted."
150 if [ -z "${OPT_KEYID}" ]; then
151 echo -n "Enter the keyid:"
153 if [ -z "${OPT_KEYID}" ]; then
154 exitOnError 1 "No keyid specified"
158 git tag -u ${OPT_KEYID} ${OPT_TAG}
159 exitOnError $? "Failed to create tag"
169 exitOnError $? "Failed to parse options"
173 git checkout ${OPT_BRANCH}
174 exitOnError $? "Invalid branch name \"${OPT_BRANCH}\""
176 (cd source3 && ./script/mkversion.sh)
177 if [ ! -f $VER_H ]; then
178 exitOnError 1 "Failed to find ${VER_H}!"
181 version=`grep "define SAMBA_VERSION_OFFICIAL_STRING" $VER_H | awk '{print $3}'`
182 vendor_version=`grep "define SAMBA_VERSION_VENDOR_SUFFIX" $VER_H | awk '{print $3}'`
183 if [ -n "$vendor_version" ]; then
184 version="$version-$vendor_version"
186 vendor_patch=`grep "define SAMBA_VERSION_VENDOR_PATCH" $VER_H | awk '{print $3}'`
187 if [ -n "$vendor_patch" ]; then
188 version="$version-$vendor_patch"
190 version=`echo $version | sed 's/\"//g'`
192 echo "Creating release tarball for Samba $version"
194 /bin/rm -rf ../samba-${version}
195 git archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
196 exitOnError $? "Failed to create release directory tree"
198 pushd ../samba-${version}
200 packaging/bin/update-pkginfo ${version} 1 ""
203 exitOnError $? "Failed to build documentation"
205 ( cd source3 && ./autogen.sh )
208 tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
209 exitOnError $? "Failed to create tarball from git tree"
211 gpg --detach-sign --armor samba-${version}.tar
212 ## exitOnError $? "Failed to sign tarball"
214 gzip -9 samba-${version}.tar
215 exitOnError $? "Failed to compress archive"
220 exitOnError $? "Failed to create release tag"