starting on Fedora packaging; reference point to begin with taken from RH 3.0.0-15...
[ira/wip.git] / packaging / Fedora / 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 SPECDIR=`rpm --eval %_specdir`
15 SRCDIR=`rpm --eval %_sourcedir`
16
17 # At this point the SPECDIR and SRCDIR vaiables must have a value!
18
19 USERID=`id -u`
20 GRPID=`id -g`
21 VERSION='PVERSION'
22 SPECFILE="samba.spec"
23 RPMVER=`rpm --version | awk '{print $3}'`
24 RPM="rpmbuild"
25
26 ##
27 ## Check the RPM version (paranoid)
28 ##
29 case $RPMVER in
30     4*)
31        echo "Supported RPM version [$RPMVER]"
32        ;;
33     *)
34        echo "Unknown RPM version: `rpm --version`"
35        exit 1
36        ;;
37 esac
38
39 ( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
40 ( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
41
42 ( cd ../../.. ; tar --exclude=CVS -cf - samba-${VERSION}/. | bzip2 > ${SRCDIR}/samba-${VERSION}.tar.bz2 )
43
44 ##
45 ## copy additional source files
46 ##
47 for file in samba.pamd samba.sysconfig samba.spec \
48         smb.init swat.desktop filter-requires-samba.sh \
49         samba.log samba.xinetd smbprint winbind.init
50 do
51         cp -p filter-requires-samba.sh ${SRCDIR}
52
53 done
54
55 chmod 755 ${SRCDIR}/filter-requires-samba.sh
56
57 ##
58 ## Build
59 ##
60 echo Getting Ready to build release package
61 cd ${SPECDIR}
62 ${RPM} -ba --clean --rmsource $SPECFILE
63
64 echo Done.
65