Makefile: reformat - break long target lines.
[Samba.git] / packaging / RHEL4-CTDB / makerpms.sh
blob238a2e8ed4caafd5e8600ed440fc4960ec4912f2
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 # set DOCS_DIR to the path to a release tarball docs dir in order to get docs
15 EXTRA_OPTIONS="$1"
17 SPECDIR=`rpm --eval %_specdir`
18 SRCDIR=`rpm --eval %_sourcedir`
20 # At this point the SPECDIR and SRCDIR vaiables must have a value!
22 USERID=`id -u`
23 GRPID=`id -g`
24 VERSION='3.0.25'
25 REVISION='ctdb'
26 SPECFILE="samba.spec"
27 RPMVER=`rpm --version | awk '{print $3}'`
28 RPM="rpmbuild"
31 ## Check the RPM version (paranoid)
33 case $RPMVER in
34 4*)
35 echo "Supported RPM version [$RPMVER]"
38 echo "Unknown RPM version: `rpm --version`"
39 exit 1
41 esac
43 pushd .
44 cd ../../source
45 if [ -f Makefile ]; then
46 make distclean
48 popd
50 pushd .
51 cd ../../
52 SRCTREE=`basename $PWD`
53 if [ $DOCS_DIR ] && [ -d $DOCS_DIR ]; then
54 mv docs docs-orig
55 ln -s $DOCS_DIR docs
57 cd ../
58 chown -R ${USERID}.${GRPID} $SRCTREE
59 if [ ! -d samba-${VERSION} ]; then
60 ln -s $SRCTREE samba-${VERSION} || exit 1
62 echo -n "Creating samba-${VERSION}.tar.bz2 ... "
63 tar --exclude=.svn --exclude=.bzr --exclude=.bzrignore --exclude=docs-orig -chf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2
64 echo "Done."
65 if [ $? -ne 0 ]; then
66 popd
67 cd ../../
68 # restore original structure if docs were specified
69 if [ ${DOCS_DIR} ] && [ -d docs-orig ] && [ -L docs ]; then
70 rm docs
71 mv docs-orig docs
73 echo "Build failed!"
74 exit 1
77 popd
81 ## copy additional source files
83 chmod 755 setup/filter-requires-samba.sh
84 tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
85 cp -p ${SPECFILE} ${SPECDIR}
88 ## Build
90 echo "$(basename $0): Getting Ready to build release package"
91 cd ${SPECDIR}
92 ${RPM} -ba --clean --rmsource $EXTRA_OPTIONS $SPECFILE
94 # restore original structure if docs were specified
95 cd ../../
96 if [ ${DOCS_DIR} ] && [ -d docs-orig ] && [ -L docs ]; then
97 rm docs
98 mv -f docs-orig docs
101 echo "$(basename $0): Done."