]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/build_rpm.sh
ebl tweak debug message
[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=2.2.8
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,wb3,rhel3,rhel4,rhel5,centos3,centos4,centos5,sl3, sl4,sl5,su9,su10,su102,su103,mdk,mdv
29 PLATFORM=su102
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 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
37 # for Mandrake set to 101mdk or 20060mdk
38 FILENAME=su102
39
40 # MySQL version
41 # set to empty (for MySQL 3), 4 or 5
42 MYSQL=5
43
44 # building wxconsole
45 # set to 1 to build wxconsole package else set 0
46 WXCONSOLE=0
47
48 # building bat
49 # set to 1 to build bat package else set 0
50 BAT=0
51
52 # enter your name and email address here
53 PACKAGER="Your Name <your-email@site.org>"
54
55 # enter the full path to your RPMS output directory
56 RPMDIR=/usr/src/packages/RPMS/i586
57
58 # enter the full path to your rpm BUILD directory
59 RPMBUILD=/usr/src/packages/BUILD
60
61 # enter your arch string here (i386, i586, i686, x86_64)
62 ARCH=i586
63
64 # if the src rpm is not in the current working directory enter the directory location
65 # with trailing slash where it is found.
66 SRPMDIR=
67
68 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
69 SIGN=1
70
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
74 SAVEUPDATEDB=0
75
76 # to override your language shell variable uncomment and edit this
77 # export LANG=en_US.UTF-8
78
79 # if you have a problem getting bat to build try these (needed on Fedora 8/9)
80 # export QTDIR=/usr/lib/qt4
81 # export PATH=/usr/lib/qt4/bin;$PATH
82
83 # Make no changes below this point without consensus
84
85 ############################################################################################
86
87 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
88
89 echo Building MySQL packages for "$PLATFORM"...
90 sleep 2
91 if [ "$WXCONSOLE" = "1" ]; then
92 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
93 --define "build_mysql${MYSQL} 1" \
94 --define "contrib_packager ${PACKAGER}" \
95 --define "build_python 1" \
96 --define "build_wxconsole 1" \
97 ${SRPM}
98 else
99 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
100 --define "build_mysql${MYSQL} 1" \
101 --define "build_python 1" \
102 --define "contrib_packager ${PACKAGER}" ${SRPM}
103 fi
104 rm -rf ${RPMBUILD}/*
105
106 echo Building PostgreSQL packages for "$PLATFORM"...
107 sleep 2
108 if [ "$BAT" = "1" ]; then
109 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
110 --define "build_postgresql 1" \
111 --define "contrib_packager ${PACKAGER}" \
112 --define "build_python 1" \
113 --define "build_bat 1" \
114 --define "nobuild_gconsole 1" ${SRPM}
115 else
116 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
117 --define "build_postgresql 1" \
118 --define "contrib_packager ${PACKAGER}" \
119 --define "build_python 1" \
120 --define "nobuild_gconsole 1" ${SRPM}
121 fi
122 rm -rf ${RPMBUILD}/*
123
124 echo Building SQLite packages for "$PLATFORM"...
125 sleep 2
126 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
127 --define "build_sqlite 1" \
128 --define "contrib_packager ${PACKAGER}" \
129 --define "build_python 1" \
130 --define "nobuild_gconsole 1" ${SRPM}
131 rm -rf ${RPMBUILD}/*
132
133 # delete the updatedb package and any debuginfo packages built
134 rm -f ${RPMDIR}/bacula*debug*
135 if [ "$SAVEUPDATEDB" = "1" ]; then
136         mv -f ${RPMDIR}/bacula-updatedb* ./;
137 else
138         rm -f ${RPMDIR}/bacula-updatedb*;
139 fi
140
141 # copy files to cwd and rename files to final upload names
142
143 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
144 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
145
146 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
147 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
148
149 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
150 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
151
152 mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
153 ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
154
155 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
156 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
157
158 mv -f ${RPMDIR}/bacula-gconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
159 ./bacula-gconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
160
161 mv -f ${RPMDIR}/bacula-wxconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
162 ./bacula-wxconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
163
164 mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
165 ./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
166
167 # now sign the packages
168 if [ "$SIGN" = "1" ]; then
169         echo Ready to sign packages...;
170         sleep 2;
171         rpm --addsign ./*.rpm;
172 fi
173
174 echo
175 echo Finished.
176 echo
177 ls
178
179 # changelog
180 # 16 Jul 2006 initial release
181 # 05 Aug 2006 add python support
182 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names
183 # 19 Aug 2006 add $LANG override to config section per request Felix Schwartz
184 # 27 Jan 2007 add fc6 target
185 # 29 Apr 2007 add sl3 & sl4 target and bat package
186 # 06 May 2007 add fc7 target
187 # 15 Sep 2007 add rhel5 and clones
188 # 10 Nov 2007 add su103
189 # 12 Jan 2008 add fc8
190 # 23 May 2008 add fc9