2008-09-12 15:50:33 +02:00
#!/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 } /../..
2009-06-23 22:41:51 +02:00
SRCDIR = ${ TOPDIR } /source3
2012-06-27 14:11:23 +02:00
VERSION_H = ${ SRCDIR } /include/autoconf/version.h
2008-09-12 15:50:33 +02:00
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
2009-06-23 23:06:40 +02:00
VERSION = ` grep "^#define SAMBA_VERSION_OFFICIAL_STRING " ${ VERSION_H } | awk '{print $3}' `
vendor_version = ` grep "^#define SAMBA_VERSION_VENDOR_SUFFIX " ${ VERSION_H } | awk '{print $3}' `
2008-09-12 15:50:33 +02:00
if test " x ${ vendor_version } " != "x" ; then
VERSION = " ${ VERSION } - ${ vendor_version } "
fi
2009-06-23 23:06:40 +02:00
vendor_patch = ` grep "^#define SAMBA_VERSION_VENDOR_PATCH " ${ VERSION_H } | awk '{print $3}' `
2009-01-21 11:03:34 +01:00
if test " x ${ vendor_patch } " != "x" ; then
VERSION = " ${ VERSION } - ${ vendor_patch } "
fi
2008-09-12 15:50:33 +02:00
VERSION = ` echo ${ VERSION } | sed 's/-/_/g' `
VERSION = ` echo ${ VERSION } | sed 's/\"//g' `
echo " VERSION: ${ VERSION } "
2009-11-04 12:26:46 +01:00
# to build a release-rpm, set USE_GITHASH="no"
# in the environmet
#
if test " x $USE_GITHASH " = "xno" ; then
GITHASH = ""
echo "GITHASH: not used"
else
GITHASH = " . $( git log --pretty= format:%h -1) "
echo " GITHASH: ${ GITHASH } "
fi
2012-09-17 18:15:03 +02:00
if test " x $BUILD_GPFS " = "xno" ; then
echo "GPFS: not build by default"
PGPFS_DEFAULT = "%{?_with_gpfs: 1} %{?!_with_gpfs: 0}"
else
echo "GPFS: build by default"
PGPFS_DEFAULT = "%{?_with_no_gpfs: 0} %{?!_with_no_gpfs: 1}"
fi
2011-05-06 12:29:10 +02:00
sed \
2012-09-17 18:15:03 +02:00
-e " s/PVERSION/ ${ VERSION } /g " \
-e " s/GITHASH/ ${ GITHASH } /g " \
-e " s/PGPFS_NO_DEFAULT/ ${ PGPFS_NO_DEFAULT } /g " \
-e " s/PGPFS_DEFAULT/ ${ PGPFS_DEFAULT } /g " \
2008-09-12 15:50:33 +02:00
< ${ SPECFILE } .tmpl \
> ${ SPECFILE }