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 # 06 Aug 2006 D. Scott Barninger
7 # Copyright (C) 2006 Kern Sibbald
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,wb3,rhel3,rhel4,centos3,centos4,su9,su10,mdk,mdv
31 # platform designator for file names
32 # for RedHat/Fedora set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5 OR
33 # for RHEL3/clones wb3, rhel3 & centos3 set to el3 OR
34 # for RHEL4/clones rhel4 & centos4 set to el4 OR
35 # for SuSE set to su90, su91, su92, su100 or su101 OR
36 # for Mandrake set to 101mdk or 20060mdk
40 # set to empty (for MySQL 3), 4 or 5
44 # set to 1 to build wxconsole package else set 0
47 # enter your name and email address here
48 PACKAGER="Your Name <your-email@site.org>"
50 # enter the full path to your RPMS output directory
51 RPMDIR=/usr/src/packages/RPMS/i586
53 # enter the full path to your rpm BUILD directory
54 RPMBUILD=/usr/src/packages/BUILD
56 # enter your arch string here (i386, i586, i686, x86_64)
59 # if the src rpm is not in the current working directory enter the directory location
60 # with trailing slash where it is found.
63 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
66 # to save the bacula-updatedb package set to 1, else 0
67 # only one updatedb package is required per release so normally this should be 0
68 # for all contrib packagers
71 ############################################################################################
73 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
75 echo Building MySQL packages for "$PLATFORM"...
77 if [ "$WXCONSOLE" = "1" ]; then
78 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
79 --define "build_mysql${MYSQL} 1" \
80 --define "contrib_packager ${PACKAGER}" \
81 --define "build_python 1" \
82 --define "build_wxconsole 1" \
85 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
86 --define "build_mysql${MYSQL} 1" \
87 --define "build_python 1" \
88 --define "contrib_packager ${PACKAGER}" ${SRPM}
92 echo Building PostgreSQL packages for "$PLATFORM"...
94 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
95 --define "build_postgresql 1" \
96 --define "contrib_packager ${PACKAGER}" \
97 --define "build_python 1" \
98 --define "nobuild_gconsole 1" ${SRPM}
101 echo Building SQLite packages for "$PLATFORM"...
103 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
104 --define "build_sqlite 1" \
105 --define "contrib_packager ${PACKAGER}" \
106 --define "build_python 1" \
107 --define "nobuild_gconsole 1" ${SRPM}
110 # delete the updatedb package and any debuginfo packages built
111 rm -f ${RPMDIR}/bacula*debug*
112 if [ "$SAVEUPDATEDB" = "1" ]; then
113 mv -f ${RPMDIR}/bacula-updatedb* ./;
115 rm -f ${RPMDIR}/bacula-updatedb*;
118 # copy files to cwd and rename files to final upload names
120 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
121 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
123 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
124 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
126 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
127 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
129 mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
130 ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
132 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
133 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
135 mv -f ${RPMDIR}/bacula-gconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
136 ./bacula-gconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
138 mv -f ${RPMDIR}/bacula-wxconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
139 ./bacula-wxconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
141 # now sign the packages
142 if [ "$SIGN" = "1" ]; then
143 echo Ready to sign packages...;
145 rpm --addsign ./*.rpm;
154 # 16 Jul 2006 initial release
155 # 05 Aug 2006 add python support
156 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names