s3:packaging: fix parsing of include.h in fill-templates
[ira/wip.git] / packaging / bin / fill-templates
1 #!/bin/sh
2
3 # Script to fill the packaging templates with the version
4 # information that is created by mkversion in advance.
5 #
6 # This is a standalone wrapper for update-pkginfo, which
7 # is ususally called from release-scripts/create-tarball.
8 # This allows for testing some aspects of packaging without
9 # the need to go through all of create-tarball.
10 #
11 # Copyright (C) Michael Adam 2009
12 #
13 # License: GPL
14
15 DIRNAME=$(dirname $0)
16 TOPDIR=${DIRNAME}/../..
17 SRCDIR=${TOPDIR}/source3
18 VERSION_H=${SRCDIR}/include/version.h
19
20 pushd ${SRCDIR} > /dev/null 2>&1
21 ./script/mkversion.sh
22 popd > /dev/null 2>&1
23
24 if [ ! -f ${VERSION_H} ] ; then
25         echo "Error creating version.h"
26         exit 1
27 fi
28
29 VERSION=`grep "define SAMBA_VERSION_OFFICIAL_STRING" ${VERSION_H} | awk '{print $3}'`
30
31 vendor_version=`grep "define SAMBA_VERSION_VENDOR_SUFFIX" ${VERSION_H} | awk '{print $3}'`
32 if test "x${vendor_version}" != "x" ; then
33         VERSION="${VERSION}-${vendor_version}"
34 fi
35
36 vendor_patch=`grep "define SAMBA_VERSION_VENDOR_PATCH" ${VERSION_H} | awk '{print $3}'`
37 if test "x${vendor_patch}" != "x" ; then
38         VERSION="${VERSION}-${vendor_patch}"
39 fi
40
41 VERSION=`echo ${VERSION} | sed 's/\"//g'`
42
43 echo "VERSION: ${VERSION}"
44
45 pushd ${TOPDIR}/packaging > /dev/null 2>&1
46 ./bin/update-pkginfo "${VERSION}" 1 ""
47 popd > /dev/null 2>&1