1#!/bin/bash
2# makerpms-cvs.sh
3# A quick script to build RPMs from cvs to test packaging
4# Buchan Milne <bgmilne@cae.co.za>
5
6[ $# -lt 1 ] &&  echo "Usage: $0 <Samba version>" && exit 1
7
8VERSION=$1
9RELEASE=0.`date +%Y%m%d`
10shift
11
12# Replace PRELEASE and PVERSION with release number in all files ending with
13# .tmpl
14
15FILES=$(find . -name "*.tmpl" -type f)
16
17for i in $FILES;do 
18	NEW=$(echo $i|sed -e 's/\.tmpl//g'); 
19	cat $i |sed -e 's/PVERSION/'$VERSION'/g; s/PRELEASE/'$RELEASE'/g'> $NEW ;
20done
21
22#Change up three directories, rename directory to samba-$VERSION, change back
23#then run makerpms.sh
24
25
26CURRENT=$(pwd)
27pushd $(dirname $(dirname $(dirname $CURRENT)))
28SAMBA_DIR=$(basename $(dirname $(dirname $CURRENT)))
29mv $SAMBA_DIR samba-$VERSION
30pushd samba-$VERSION/source
31./autogen.sh
32popd
33pushd samba-$VERSION/packaging/Mandrake
34sh makerpms.sh $@
35popd
36mv samba-$VERSION $SAMBA_DIR
37popd
38