Streamline cli_push sync wrapper
[Samba.git] / packaging / RHEL / makerpms.sh.tmpl
blob5b377bda575d2686157a3c080fa72ed59949ae6d
1 #!/bin/sh
2 # Copyright (C) John H Terpstra 1998-2002
3 # Gerald (Jerry) Carter 2003
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
10 # Note: Under this directory rpm expects to find the same directories that are under the
11 # /usr/src/redhat directory
14 EXTRA_OPTIONS="$1"
16 SPECDIR=`rpm --eval %_specdir`
17 SRCDIR=`rpm --eval %_sourcedir`
19 # At this point the SPECDIR and SRCDIR vaiables must have a value!
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"
30 ## Check the RPM version (paranoid)
32 case $RPMVER in
33 4*)
34 echo "Supported RPM version [$RPMVER]"
37 echo "Unknown RPM version: `rpm --version`"
38 exit 1
40 esac
42 pushd .
43 cd ../../source
44 if [ -f Makefile ]; then
45 make distclean
47 popd
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
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
63 popd
67 ## copy additional source files
69 chmod 755 setup/filter-requires-samba.sh
70 tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
71 cp -p ${SPECFILE} ${SPECDIR}
74 ## Build
76 echo "$(basename $0): Getting Ready to build release package"
77 cd ${SPECDIR}
78 ${RPM} -ba --clean --rmsource $EXTRA_OPTIONS $SPECFILE
80 echo "$(basename $0): Done."