s3:packaging: Fix typo in comment.
[sfrench/samba-autobuild/.git] / packaging / RHEL / makerpms.sh.tmpl
1 #!/bin/sh
2 # Copyright (C) John H Terpstra 1998-2002
3 #               Gerald (Jerry) Carter 2003
4
5 # The following allows environment variables to override the target directories
6 #   the alternative is to have a file in your home directory calles .rpmmacros
7 #   containing the following:
8 #   %_topdir  /home/mylogin/redhat
9 #
10 # Note: Under this directory rpm expects to find the same directories that are under the
11 #   /usr/src/redhat directory
12 #
13
14 EXTRA_OPTIONS="$1"
15
16 SPECDIR=`rpm --eval %_specdir`
17 SRCDIR=`rpm --eval %_sourcedir`
18
19 # At this point the SPECDIR and SRCDIR variables must have a value!
20
21 USERID=`id -u`
22 GRPID=`id -g`
23 VERSION='PVERSION'
24 REVISION='PREVISION'
25 SPECFILE="samba.spec"
26 RPMVER=`rpm --version | awk '{print $3}'`
27 RPM="rpmbuild"
28
29 ##
30 ## Check the RPM version (paranoid)
31 ##
32 case $RPMVER in
33     4*)
34        echo "Supported RPM version [$RPMVER]"
35        ;;
36     *)
37        echo "Unknown RPM version: `rpm --version`"
38        exit 1
39        ;;
40 esac
41
42 pushd .
43 cd ../../source3
44 if [ -f Makefile ]; then
45         make distclean
46 fi
47 popd
48
49 pushd .
50 cd ../../../
51 chown -R ${USERID}.${GRPID} samba-${VERSION}${REVISION}
52 if [ ! -d samba-${VERSION} ]; then
53         ln -s samba-${VERSION}${REVISION} samba-${VERSION} || exit 1
54 fi
55 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
56 tar --exclude=.svn -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2
57 echo "Done."
58 if [ $? -ne 0 ]; then
59         echo "Build failed!"
60         exit 1
61 fi
62
63 popd
64
65
66 ##
67 ## copy additional source files
68 ##
69 chmod 755 setup/filter-requires-samba.sh
70 tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
71 cp -p ${SPECFILE} ${SPECDIR}
72
73 ##
74 ## Build
75 ##
76 echo "$(basename $0): Getting Ready to build release package"
77 cd ${SPECDIR}
78 ${RPM} -ba --clean --rmsource $EXTRA_OPTIONS $SPECFILE
79
80 echo "$(basename $0): Done."
81