]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/build_rpm.sh
Remove mysql version variable.
[bacula/bacula] / bacula / platforms / contrib-rpm / build_rpm.sh
1 #!/bin/bash
2
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
6
7 # Copyright (C) 2006 Free Software Foundation Europe e.V.
8 # licensed under GPL-v2
9
10 # signing rpms
11 # Make sure you have a .rpmmacros file in your home directory containing the following:
12 #
13 # %_signature gpg
14 # %_gpg_name Your Name <your-email@site.org>
15 #
16 # the %_gpg_name information must match your key
17
18
19 # usage: ./build_rpm.sh
20
21 ###########################################################################################
22 # script configuration section
23
24 VERSION=5.0.0
25 RELEASE=1
26
27 # build platform for spec
28 # set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5,fc6,fc7,fc8,fc9,fc10,wb3,rhel3,rhel4,rhel5,centos3,centos4,centos5,sl3, sl4,sl5,su9,su10,su102,su103,su110,su111,su112,mdk,mdv
29 PLATFORM=su111
30
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,fc10 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
38 FILENAME=su111
39
40 # enter your name and email address here
41 PACKAGER="Your Name <your-email@site.org>"
42
43 # enter the full path to your RPMS output directory
44 RPMDIR=/usr/src/packages/RPMS/i586
45 RPMDIR2=/usr/src/packages/RPMS/noarch
46
47 # enter the full path to your rpm BUILD directory
48 RPMBUILD=/usr/src/packages/BUILD
49
50 # enter your arch string here (i386, i586, i686, x86_64)
51 ARCH=i586
52
53 # if the src rpm is not in the current working directory enter the directory location
54 # with trailing slash where it is found.
55 SRPMDIR=
56
57 # to build the mtx package set to 1, else 0
58 BUILDMTX=0
59
60 # to build the bat package set to 1, else 0
61 BUILDBAT=1
62
63 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
64 SIGN=0
65
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
69 SAVEUPDATEDB=0
70
71 # to override your language shell variable uncomment and edit this
72 # export LANG=en_US.UTF-8
73
74 # this is now in the spec file but when building bat on older versions uncomment
75 #export QTDIR=$(pkg-config --variable=prefix QtCore)
76 #export QTINC=$(pkg-config --variable=includedir QtCore)
77 #export QTLIB=$(pkg-config --variable=libdir QtCore)
78 #export PATH=${QTDIR}/bin/:${PATH}
79
80 # Make no changes below this point without consensus
81
82 ############################################################################################
83
84 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
85 SRPM2=${SRPMDIR}bacula-bat-$VERSION-$RELEASE.src.rpm
86 SRPM3=${SRPMDIR}bacula-docs-$VERSION-$RELEASE.src.rpm
87 SRPM4=${SRPMDIR}bacula-mtx-$VERSION-$RELEASE.src.rpm
88
89 echo Building MySQL packages for "$PLATFORM"...
90 sleep 2
91 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
92 --define "build_mysql 1" \
93 --define "build_python 1" \
94 --define "contrib_packager ${PACKAGER}" ${SRPM}
95 rm -rf ${RPMBUILD}/*
96
97 echo Building PostgreSQL packages for "$PLATFORM"...
98 sleep 2
99 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
100 --define "build_postgresql 1" \
101 --define "contrib_packager ${PACKAGER}" \
102 --define "build_python 1" ${SRPM}
103 rm -rf ${RPMBUILD}/*
104
105 echo Building SQLite packages for "$PLATFORM"...
106 sleep 2
107 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
108 --define "build_sqlite 1" \
109 --define "contrib_packager ${PACKAGER}" \
110 --define "build_python 1" ${SRPM}
111 rm -rf ${RPMBUILD}/*
112
113 if [ "$BUILDBAT" = "1" ]; then
114         echo Building Bat package for "$PLATFORM"...
115         sleep 2
116         rpmbuild --rebuild ${SRPM2}
117         rm -rf ${RPMBUILD}/*
118 fi
119
120 echo Building Docs package for "$PLATFORM"...
121 sleep 2
122 rpmbuild --rebuild ${SRPM3}
123 rm -rf ${RPMBUILD}/*
124
125 if [ "$BUILDMTX" = "1" ]; then
126         echo Building mtx package for "$PLATFORM"...
127         sleep 2
128         rpmbuild --rebuild ${SRPM4}
129         rm -rf ${RPMBUILD}/*
130 fi
131
132 # delete the updatedb package and any debuginfo packages built
133 rm -f ${RPMDIR}/bacula*debug*
134 if [ "$SAVEUPDATEDB" = "1" ]; then
135         mv -f ${RPMDIR}/bacula-updatedb* ./;
136 else
137         rm -f ${RPMDIR}/bacula-updatedb*;
138 fi
139
140 # copy files to cwd and rename files to final upload names
141
142 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
143 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
144
145 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
146 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
147
148 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
149 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
150
151 if [ "$BUILDMTX" = "1" ]; then
152         mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
153         ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
154 fi
155
156 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
157 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
158
159 if [ "$BUILDBAT" = "1" ]; then
160         mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
161         ./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
162 fi
163
164 mv -f ${RPMDIR2}/bacula-docs-${VERSION}-${RELEASE}.noarch.rpm .
165
166 # now sign the packages
167 if [ "$SIGN" = "1" ]; then
168         echo Ready to sign packages...;
169         sleep 2;
170         rpm --addsign ./*.rpm;
171 fi
172
173 echo
174 echo Finished.
175 echo
176 ls
177
178 # changelog
179 # 16 Jul 2006 initial release
180 # 05 Aug 2006 add python support
181 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names
182 # 19 Aug 2006 add $LANG override to config section per request Felix Schwartz
183 # 27 Jan 2007 add fc6 target
184 # 29 Apr 2007 add sl3 & sl4 target and bat package
185 # 06 May 2007 add fc7 target
186 # 15 Sep 2007 add rhel5 and clones
187 # 10 Nov 2007 add su103
188 # 12 Jan 2008 add fc8
189 # 23 May 2008 add fc9
190 # 28 Jun 2008 add su110
191 # 08 Nov 2008 add use of pkgconfig to obtain QT4 paths
192 # 31 Dec 2008 add su111
193 # 05 Apr 2009 deprecate gconsole and wxconsole, bat built by default
194 # 30 Jan 2010 adjust for mtx, bat and docs in separate srpm
195 # 20 Feb 2010 remove mysql version number