]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/build_rpm.sh
0807bd7e2e93b5a7af4c29c4b1c6b8bd665d8055
[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.0.2
25 RELEASE=1
26
27 # build platform for spec
28 # set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5,fc6,wb3,rhel3,rhel4,centos3,centos4,su9,su10,su102,mdk,mdv
29 PLATFORM=su10
30
31 # platform designator for file names
32 # for RedHat/Fedora set to one of rh7,rh8,rh9,fc1,fc3,fc4,fc5,fc6 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
37 FILENAME=su100
38
39 # MySQL version
40 # set to empty (for MySQL 3), 4 or 5
41 MYSQL=4
42
43 # building wxconsole
44 # set to 1 to build wxconsole package else set 0
45 WXCONSOLE=0
46
47 # enter your name and email address here
48 PACKAGER="Your Name <your-email@site.org>"
49
50 # enter the full path to your RPMS output directory
51 RPMDIR=/usr/src/packages/RPMS/i586
52
53 # enter the full path to your rpm BUILD directory
54 RPMBUILD=/usr/src/packages/BUILD
55
56 # enter your arch string here (i386, i586, i686, x86_64)
57 ARCH=i586
58
59 # if the src rpm is not in the current working directory enter the directory location
60 # with trailing slash where it is found.
61 SRPMDIR=
62
63 # set to 1 to sign packages, 0 not to sign if you want to sign on another machine.
64 SIGN=1
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 # Make no changes below this point without consensus
75
76 ############################################################################################
77
78 SRPM=${SRPMDIR}bacula-$VERSION-$RELEASE.src.rpm
79
80 echo Building MySQL packages for "$PLATFORM"...
81 sleep 2
82 if [ "$WXCONSOLE" = "1" ]; then
83 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
84 --define "build_mysql${MYSQL} 1" \
85 --define "contrib_packager ${PACKAGER}" \
86 --define "build_python 1" \
87 --define "build_wxconsole 1" \
88 ${SRPM}
89 else
90 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
91 --define "build_mysql${MYSQL} 1" \
92 --define "build_python 1" \
93 --define "contrib_packager ${PACKAGER}" ${SRPM}
94 fi
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" \
103 --define "nobuild_gconsole 1" ${SRPM}
104 rm -rf ${RPMBUILD}/*
105
106 echo Building SQLite packages for "$PLATFORM"...
107 sleep 2
108 rpmbuild --rebuild --define "build_${PLATFORM} 1" \
109 --define "build_sqlite 1" \
110 --define "contrib_packager ${PACKAGER}" \
111 --define "build_python 1" \
112 --define "nobuild_gconsole 1" ${SRPM}
113 rm -rf ${RPMBUILD}/*
114
115 # delete the updatedb package and any debuginfo packages built
116 rm -f ${RPMDIR}/bacula*debug*
117 if [ "$SAVEUPDATEDB" = "1" ]; then
118         mv -f ${RPMDIR}/bacula-updatedb* ./;
119 else
120         rm -f ${RPMDIR}/bacula-updatedb*;
121 fi
122
123 # copy files to cwd and rename files to final upload names
124
125 mv -f ${RPMDIR}/bacula-mysql-${VERSION}-${RELEASE}.${ARCH}.rpm \
126 ./bacula-mysql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
127
128 mv -f ${RPMDIR}/bacula-postgresql-${VERSION}-${RELEASE}.${ARCH}.rpm \
129 ./bacula-postgresql-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
130
131 mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
132 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
133
134 mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
135 ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
136
137 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
138 ./bacula-client-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
139
140 mv -f ${RPMDIR}/bacula-gconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
141 ./bacula-gconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
142
143 mv -f ${RPMDIR}/bacula-wxconsole-${VERSION}-${RELEASE}.${ARCH}.rpm \
144 ./bacula-wxconsole-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
145
146 # now sign the packages
147 if [ "$SIGN" = "1" ]; then
148         echo Ready to sign packages...;
149         sleep 2;
150         rpm --addsign ./*.rpm;
151 fi
152
153 echo
154 echo Finished.
155 echo
156 ls
157
158 # changelog
159 # 16 Jul 2006 initial release
160 # 05 Aug 2006 add python support
161 # 06 Aug 2006 add remote source directory, add switch for signing, refine file names
162 # 19 Aug 2006 add $LANG override to config section per request Felix Schwartz
163 # 27 Jan 2007 add fc6
164