3 # shell script to build bacula rpm release
4 # copy this script into a working directory with the src rpm to build and execute
5 # 19 Aug 2006 D. Scott Barninger
7 # Copyright (C) 2006 Free Software Foundation Europe e.V.
8 # licensed under GPL-v2
11 # Make sure you have a .rpmmacros file in your home directory containing the following:
14 # %_gpg_name Your Name <your-email@site.org>
16 # the %_gpg_name information must match your key
19 # usage: ./build_rpm.sh
21 ###########################################################################################
22 # script configuration section
27 # build platform for spec
28 # set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5,fc6,fc7,fc8,fc9,wb3,rhel3,rhel4,rhel5,centos3,centos4,centos5,sl3, sl4,sl5,su9,su10,su102,su103,su110,su111,su112,mdk,mdv
31 # platform designator for file names
32 # for RedHat/Fedora set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5,fc6,fc7,fc8,fc9 OR
33 # for RHEL3/clones wb3, rhel3, sl3 & centos3 set to el3 OR
34 # for RHEL4/clones rhel4, sl4 & centos4 set to el4 OR
35 # for RHEL5/clones rhel5, sl5 & centos5 set to el5 OR
36 # for SuSE set to su90, su91, su92, su100 or su101 or su102 or su103 or su110 or su111 or su112 OR
37 # for Mandrake set to 101mdk or 20060mdk
41 # set to empty (for MySQL 3), 4 or 5
44 # enter your name and email address here
45 PACKAGER="D. Scott Barninger <barninger@fairfieldcomputers.com>"
47 # enter the full path to your RPMS output directory
48 RPMDIR=/usr/src/packages/RPMS/i586
49 RPMDIR2=/usr/src/packages/RPMS/noarch
51 # enter the full path to your rpm BUILD directory
52 RPMBUILD=/usr/src/packages/BUILD
54 # enter your arch string here (i386, i586, i686, x86_64)
57 # if the src rpm is not in the current working directory enter the directory location
58 # with trailing slash where it is found.
61 # to build the mtx package set to 1, else 0
64 # to build the bat package set to 1, else 0
67 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
70 # to save the bacula-updatedb package set to 1, else 0
71 # only one updatedb package is required per release so normally this should be 0
72 # for all contrib packagers
75 # to override your language shell variable uncomment and edit this
76 # export LANG=en_US.UTF-8
78 # this is now in the spec file but when building bat on older versions uncomment
79 #export QTDIR=$(pkg-config --variable=prefix QtCore)
80 #export QTINC=$(pkg-config --variable=includedir QtCore)
81 #export QTLIB=$(pkg-config --variable=libdir QtCore)
82 #export PATH=${QTDIR}/bin/:${PATH}
84 # Make no changes below this point without consensus
86 ############################################################################################
88 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
89 SRPM2=${SRPMDIR}bacula-bat-$VERSION-$RELEASE.src.rpm
90 SRPM3=${SRPMDIR}bacula-docs-$VERSION-$RELEASE.src.rpm
91 SRPM4=${SRPMDIR}bacula-mtx-$VERSION-$RELEASE.src.rpm
93 echo Building MySQL packages for "$PLATFORM"...
95 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
96 --define "build_mysql${MYSQL} 1" \
97 --define "build_python 1" \
98 --define "contrib_packager ${PACKAGER}" ${SRPM}
101 echo Building PostgreSQL packages for "$PLATFORM"...
103 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
104 --define "build_postgresql 1" \
105 --define "contrib_packager ${PACKAGER}" \
106 --define "build_python 1" ${SRPM}
109 echo Building SQLite packages for "$PLATFORM"...
111 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
112 --define "build_sqlite 1" \
113 --define "contrib_packager ${PACKAGER}" \
114 --define "build_python 1" ${SRPM}
117 if [ "$BUILDBAT" = "1" ]; then
118 echo Building Bat package for "$PLATFORM"...
120 rpmbuild --rebuild ${SRPM2}
124 echo Building Docs package for "$PLATFORM"...
126 rpmbuild --rebuild ${SRPM3}
129 if [ "$BUILDMTX" = "1" ]; then
130 echo Building mtx package for "$PLATFORM"...
132 rpmbuild --rebuild ${SRPM4}
136 # delete the updatedb package and any debuginfo packages built
137 rm -f ${RPMDIR}/bacula*debug*
138 if [ "$SAVEUPDATEDB" = "1" ]; then
139 mv -f ${RPMDIR}/bacula-updatedb* ./;
141 rm -f ${RPMDIR}/bacula-updatedb*;
144 # copy files to cwd and rename files to final upload names
146 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
147 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
149 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
150 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
152 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
153 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
155 if [ "$BUILDMTX" = "1" ]; then
156 mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
157 ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
160 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
161 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
163 mv -f ${RPMDIR}/bacula-libs-${VERSION}-${RELEASE}.${ARCH}.rpm \
164 ./bacula-libs-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
166 if [ "$BUILDBAT" = "1" ]; then
167 mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
168 ./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
171 mv -f ${RPMDIR2}/bacula-docs-${VERSION}-${RELEASE}.noarch.rpm .
173 # now sign the packages
174 if [ "$SIGN" = "1" ]; then
175 echo Ready to sign packages...;
177 rpm --addsign ./*.rpm;
186 # 16 Jul 2006 initial release
187 # 05 Aug 2006 add python support
188 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names
189 # 19 Aug 2006 add $LANG override to config section per request Felix Schwartz
190 # 27 Jan 2007 add fc6 target
191 # 29 Apr 2007 add sl3 & sl4 target and bat package
192 # 06 May 2007 add fc7 target
193 # 15 Sep 2007 add rhel5 and clones
194 # 10 Nov 2007 add su103
195 # 12 Jan 2008 add fc8
196 # 23 May 2008 add fc9
197 # 28 Jun 2008 add su110
198 # 08 Nov 2008 add use of pkgconfig to obtain QT4 paths
199 # 31 Dec 2008 add su111
200 # 05 Apr 2009 deprecate gconsole and wxconsole, bat built by default
201 # 30 Jan 2010 adjust for mtx, bat and docs in separate srpm
202 # 02 May 2010 add bacula-libs package