Initial import
[samba] / packaging / RedHat-9 / makerpms.sh.tmpl
1 #!/bin/sh
2 # Copyright (C) John H Terpstra 1998-2002
3 # Updated for RPM 3 by Jochen Wiedmann, joe@ispsoft.de
4 # Changed for a generic tar file rebuild by abartlet@pcug.org.au
5 # Changed by John H Terpstra to build on RH7.2 - should also work for earlier versions jht@samba.org
6
7 # The following allows environment variables to override the target directories
8 #   the alternative is to have a file in your home directory calles .rpmmacros
9 #   containing the following:
10 #   %_topdir  /home/mylogin/redhat
11 #
12 # Note: Under this directory rpm expects to find the same directories that are under the
13 #   /usr/src/redhat directory
14 #
15
16 SPECDIR=`rpm --eval %_specdir`
17 SRCDIR=`rpm --eval %_sourcedir`
18
19 # At this point the SPECDIR and SRCDIR vaiables must have a value!
20
21 USERID=`id -u`
22 GRPID=`id -g`
23 VERSION='PVERSION'
24 SPECFILE="samba3.spec"
25 RPMVER=`rpm --version | awk '{print $3}'`
26 RPM="rpm"
27 echo The RPM Version on this machine is: $RPMVER
28
29 ##
30 ## fix the mandir macro
31 ##
32 case $RPMVER in
33     [23]*)
34        sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba.spec > $SPECFILE
35        ;;
36     4*)
37        sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba.spec > $SPECFILE
38        ;;
39     *)
40        echo "Unknown RPM version: `rpm --version`"
41        exit 1
42        ;;
43 esac
44
45 ##
46 ## now catch the right command to build an RPM (defaults ro 'rpm'
47 ##
48 case $RPMVER in
49     4.[123]*)
50        RPM="rpmbuild"
51        ;;
52 esac
53
54 echo "RPM build command is \"$RPM\""
55
56 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
57 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
58
59 ( cd ../../.. ; tar --exclude=CVS -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2 )
60
61 /bin/cp -p filter-requires-samba_rh8.sh ${SRCDIR}
62 /bin/cp -p filter-requires-samba_rh9.sh ${SRCDIR}
63 chmod 755 ${SRCDIR}/filter-requires-samba_rh?.sh
64 /bin/cp -av $SPECFILE ${SPECDIR}
65
66 echo Getting Ready to build release package
67 cd ${SPECDIR}
68 ${RPM} -ba --clean --rmsource $SPECFILE
69
70 echo Done.
71