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,wb3,rhel3,rhel4,rhel5,centos3,centos4,centos5,sl3, sl4,sl5,su9,su10,su102,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 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
37 # for Mandrake set to 101mdk or 20060mdk
41 # set to empty (for MySQL 3), 4 or 5
45 # set to 1 to build wxconsole package else set 0
49 # set to 1 to build bat package else set 0
52 # enter your name and email address here
53 PACKAGER="Your Name <your-email@site.org>"
55 # enter the full path to your RPMS output directory
56 RPMDIR=/usr/src/packages/RPMS/i586
58 # enter the full path to your rpm BUILD directory
59 RPMBUILD=/usr/src/packages/BUILD
61 # enter your arch string here (i386, i586, i686, x86_64)
64 # if the src rpm is not in the current working directory enter the directory location
65 # with trailing slash where it is found.
68 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
71 # to save the bacula-updatedb package set to 1, else 0
72 # only one updatedb package is required per release so normally this should be 0
73 # for all contrib packagers
76 # to override your language shell variable uncomment and edit this
77 # export LANG=en_US.UTF-8
79 # Make no changes below this point without consensus
81 ############################################################################################
83 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
85 echo Building MySQL packages for "$PLATFORM"...
87 if [ "$WXCONSOLE" = "1" ]; then
88 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
89 --define "build_mysql${MYSQL} 1" \
90 --define "contrib_packager ${PACKAGER}" \
91 --define "build_python 1" \
92 --define "build_wxconsole 1" \
95 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
96 --define "build_mysql${MYSQL} 1" \
97 --define "build_python 1" \
98 --define "contrib_packager ${PACKAGER}" ${SRPM}
102 echo Building PostgreSQL packages for "$PLATFORM"...
104 if [ "$BAT" = "1" ]; then
105 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
106 --define "build_postgresql 1" \
107 --define "contrib_packager ${PACKAGER}" \
108 --define "build_python 1" \
109 --define "build_bat 1" \
110 --define "nobuild_gconsole 1" ${SRPM}
112 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
113 --define "build_postgresql 1" \
114 --define "contrib_packager ${PACKAGER}" \
115 --define "build_python 1" \
116 --define "nobuild_gconsole 1" ${SRPM}
120 echo Building SQLite packages for "$PLATFORM"...
122 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
123 --define "build_sqlite 1" \
124 --define "contrib_packager ${PACKAGER}" \
125 --define "build_python 1" \
126 --define "nobuild_gconsole 1" ${SRPM}
129 # delete the updatedb package and any debuginfo packages built
130 rm -f ${RPMDIR}/bacula*debug*
131 if [ "$SAVEUPDATEDB" = "1" ]; then
132 mv -f ${RPMDIR}/bacula-updatedb* ./;
134 rm -f ${RPMDIR}/bacula-updatedb*;
137 # copy files to cwd and rename files to final upload names
139 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
140 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
142 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
143 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
145 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
146 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
148 mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
149 ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
151 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
152 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
154 mv -f ${RPMDIR}/bacula-gconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
155 ./bacula-gconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
157 mv -f ${RPMDIR}/bacula-wxconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
158 ./bacula-wxconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
160 mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
161 ./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
163 # now sign the packages
164 if [ "$SIGN" = "1" ]; then
165 echo Ready to sign packages...;
167 rpm --addsign ./*.rpm;
176 # 16 Jul 2006 initial release
177 # 05 Aug 2006 add python support
178 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names
179 # 19 Aug 2006 add $LANG override to config section per request Felix Schwartz
180 # 27 Jan 2007 add fc6 target
181 # 29 Apr 2007 add sl3 & sl4 target and bat package
182 # 06 May 2007 add fc7 target
183 # 15 Sep 2007 add rhel5 and clones