r38: Fix caching of name->sid lookups
[Samba/gebeck_regimport.git] / packaging / Mandrake / makerpms.sh.tmpl
blob5d06e2bbccaf33453cf1fb2acc225ac9feb565ec
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 # Taken from Red Hat build area by JHT
6 # Changed by John H Terpstra to build on RH8.1 - should also work for earlier versions jht@samba.org
7 # Changes from Buchan Milne <bgmilne@cae.co.za>
9 # The following allows environment variables to override the target directories
10 # the alternative is to have a file in your home directory calles .rpmmacros
11 # containing the following:
12 # %_topdir /home/mylogin/RPM
15 # rpm --eval should always give a correct answer for this
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'
25 RPMVER=`rpm --version | awk '{print $3}'`
26 echo The RPM Version on this machine is: $RPMVER
28 case $RPMVER in
29 2*)
30 echo Building for RPM v2.x
31 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
33 3*)
34 echo Building for RPM v3.x
35 sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba.spec
37 4*)
38 echo Building for RPM v4.x
39 sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba2.spec > samba.spec
42 echo "Unknown RPM version: `rpm --version`"
43 exit 1
45 esac
47 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
48 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
49 echo "Compressing the source as bzip2, may take a while ..."
50 ( cd ../../.. ; tar --exclude=CVS -cjf ${SRCDIR}/samba-${VERSION}.tar.bz2 samba-${VERSION} )
52 cp -av samba.spec ${SPECDIR}
53 # cp -a *.patch.bz2 *.xpm.bz2 smb.* samba.xinetd samba.log $SRCDIR
54 # Prepare to allow straight patches synced from Mandrake cvs:
55 # Updating of sources and patches can be done more easily and accurately
56 # by using info in the spec file. It won't work for files that use an rpm
57 # macro in their name, but that shouldn't be a problem.
59 SOURCES=`awk '/^Source/ {print $2}' samba.spec |grep -v "%{"`
60 PATCHES=`awk '/^Patch/ {print $2}' samba.spec`
62 for i in $PATCHES $SOURCES;do
63 # We have two cases to fix, one where it's bzip2'ed
64 # in the spec and not in CVS, one where it's bzip2'ed
65 # in CVS but not in the spec
66 [ -e $i ] && cp -av $i $SRCDIR
67 i_nobz2=`echo $i|sed -e 's/.bz2$//'`
68 i_bz2=$i.bz2
69 [ -e $i_nobz2 ] && bzip2 -kf $i_nobz2 && mv -fv $i $SRCDIR
70 [ -e $i_bz2 ] && bunzip2 -kf $i_bz2 && mv -fv $i $SRCDIR
71 done
73 echo Getting Ready to build release package
74 cd ${SPECDIR}
75 rpm -ba -v --clean --rmsource samba.spec $@
77 echo Done.