summaryrefslogtreecommitdiff
path: root/packaging/RHEL-CTDB/makespec.sh
blob: 29a2c42517c6f8342e103e8b0e32931155badfde (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
#!/bin/sh
#
# Copyright (C) Michael Adam 2008
#
# Script to determine the samba version and create the SPEC file from template

DIRNAME=$(dirname $0)
TOPDIR=${DIRNAME}/../..
SRCDIR=${TOPDIR}/source3
VERSION_H=${SRCDIR}/include/version.h
SPECFILE=${DIRNAME}/samba.spec

##
## determine the samba version and create the SPEC file
##
pushd ${SRCDIR}
./script/mkversion.sh
popd
if [ ! -f ${VERSION_H} ] ; then
	echo "Error creating version.h"
	exit 1
fi

VERSION=`grep SAMBA_VERSION_OFFICIAL_STRING ${VERSION_H} | awk '{print $3}'`
vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX ${VERSION_H} | awk '{print $3}'`
if test "x${vendor_version}"  != "x" ; then
	VERSION="${VERSION}-${vendor_version}"
fi
vendor_patch=`grep SAMBA_VERSION_VENDOR_PATCH ${VERSION_H} | awk '{print $3}'`
if test "x${vendor_patch}" != "x" ; then
	VERSION="${VERSION}-${vendor_patch}"
fi
VERSION=`echo ${VERSION} | sed 's/-/_/g'`
VERSION=`echo ${VERSION} | sed 's/\"//g'`
echo "VERSION: ${VERSION}"
sed -e s/PVERSION/${VERSION}/g \
	< ${SPECFILE}.tmpl \
	> ${SPECFILE}