summaryrefslogtreecommitdiffstats
path: root/builddsrpm.sh
blob: 6ce63bc617cbef4c5a71ae519dfb8b65d8b9c065 (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
40
#!/bin/sh -v

mkdirs() {
	for d in "$@" ; do
		if [ -d $d ]; then
			mv $d $d.deleted
			rm -rf $d.deleted &
		fi
		mkdir -p $d
	done
}

if [ ! -f $HOME/.rpmmacros ]; then
	echo "This script assumes you want to build as a non-root"
	echo "user and in a non-default place (e.g. your home dir)"
	echo "You must have a $HOME/.rpmmacros file that redefines"
	echo "_topdir e.g."
	echo "%_topdir	/home/rmeggins/ds71"
	echo "Please create that file with the above contents and"
	echo "rerun this script."
	exit 1
fi

NAME=ldapserver
VERSION=7.1
# change HEAD to a real static tag when available
CVSTAG=HEAD

mkdirs SOURCES BUILD SRPMS RPMS
cd SOURCES
rm -rf $NAME-$VERSION $NAME-$VERSION.tar.gz
echo "Checking out source code . . ."
cvs export -r $CVSTAG -d $NAME-$VERSION $NAME > /dev/null 2>&1
echo "Building tarball . . ."
tar cf - $NAME-$VERSION | gzip > $NAME-$VERSION.tar.gz
rm -rf $NAME-$VERSION
cd ..
echo "Executing rpmbuild . . ."
rpmbuild -ba $NAME.spec
echo "Finished doing rpmbuild $NAME.spec"