]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula.spec.in
Optimize tree.c a bit, take Scott's spec & patch
[bacula/bacula] / bacula / platforms / redhat / bacula.spec.in
1
2 %define depkgs ../depkgs
3
4
5 # You must build the package with at least one define
6 #  e.g.  rpmbuild -ba --define "build_rh7 1" bacula.spec
7 #
8 # If you want the MySQL version, use:
9 #        rpmbuild -ba --define "build_mysql 1" --define "build_rh7 1" bacula.spec
10 #
11
12 %define rh7 0
13 %{?build_rh7:%define rh7 1}
14
15 %define rh8 0
16 %{?build_rh8:%define rh8 1}
17
18 %define rh9 0
19 %{?build_rh9:%define rh9 1}
20
21 %define mysql 0
22 %{?build_mysql:%define mysql 1}
23
24
25 %if %{rh7}
26 %define rh_version rh7
27 %endif
28 %if %{rh8}
29 %define rh_version rh8
30 %endif
31 %if %{rh9}
32 %define rh_version rh9
33 %endif
34
35 Summary: Bacula - The Network Backup Solution
36 Name: bacula
37 Version: @VERSION@
38 Release: 1
39 Group: System Environment/Daemons
40 Copyright: GPL v2
41 Source0:http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
42 Source1:http://www.prdownloads.sourceforge.net/bacula/depkgs-24Jul03.tar.gz
43 BuildRoot: %{_tmppath}/%{name}-root
44 URL: http://www.bacula.org/
45 Vendor: The Bacula Team
46 Distribution: The Bacula Team
47 Packager: D. Scott Barninger <barninger@fairfieldcomputers.com>
48 Requires: gnome-libs >= 1.4
49 Requires: readline
50 BuildRequires: gnome-libs-devel >= 1.4
51 BuildRequires: readline-devel
52 %if %{mysql}
53 Requires: mysql >= 3.23
54 Requires: mysql-server >= 3.23
55 BuildRequires: mysql-devel >= 3.23
56 %endif
57
58
59 %description
60 Bacula - It comes by night and sucks the vital essence from your computers.
61
62 Bacula is a set of computer programs that permit you (or the system 
63 administrator) to manage backup, recovery, and verification of computer 
64 data across a network of computers of different kinds. In technical terms, 
65 it is a network client/server based backup program. Bacula is relatively 
66 easy to use and efficient, while offering many advanced storage management 
67 features that make it easy to find and recover lost or damaged files. 
68 Bacula source code has been released under the GPL version 2 license.
69
70 %if %{mysql}
71 %package mysql-%{rh_version}
72 %else
73 %package sqlite-%{rh_version}
74 %endif
75
76 Summary: Bacula - The Network Backup Solution
77 Group: System Environment/Daemons
78
79 %if %{mysql}
80 %description mysql-%{rh_version}
81 %else
82 %description sqlite-%{rh_version}
83 %endif
84
85 Bacula - It comes by night and sucks the vital essence from your computers.
86
87 Bacula is a set of computer programs that permit you (or the system 
88 administrator) to manage backup, recovery, and verification of computer 
89 data across a network of computers of different kinds. In technical terms, 
90 it is a network client/server based backup program. Bacula is relatively 
91 easy to use and efficient, while offering many advanced storage management 
92 features that make it easy to find and recover lost or damaged files. 
93 Bacula source code has been released under the GPL version 2 license.
94
95 %if %{mysql}
96 This build requires MySQL to be installed separately as the catalog database.
97 %else
98 This build incorporates sqlite as the catalog database, statically compiled.
99 %endif
100
101 %package client-%{rh_version}
102 Summary: Bacula - The Network Backup Solution
103 Group: System Environment/Daemons
104 %description client-%{rh_version}
105 Bacula - It comes by night and sucks the vital essence from your computers.
106
107 Bacula is a set of computer programs that permit you (or the system 
108 administrator) to manage backup, recovery, and verification of computer 
109 data across a network of computers of different kinds. In technical terms, 
110 it is a network client/server based backup program. Bacula is relatively 
111 easy to use and efficient, while offering many advanced storage management 
112 features that make it easy to find and recover lost or damaged files. 
113 Bacula source code has been released under the GPL version 2 license.
114
115 This is the File daemon (Client) only package.
116
117
118 %prep
119
120 %setup -b 1
121
122 %build
123
124 cwd=${PWD}
125 cd %{depkgs}
126 %if ! %{mysql}
127 make sqlite
128 %endif
129 make mtx
130 cd ${cwd}
131
132 # patch the make_sqlite_tables script for installation bindir
133 patch src/cats/make_sqlite_tables.in src/cats/make_sqlite_tables.in.patch
134
135 # patch the make_catalog_backup script for installation bindir
136 patch src/cats/make_catalog_backup.in src/cats/make_catalog_backup.in.patch
137
138 %configure \
139         --prefix=/usr \
140         --sbindir=/usr/sbin \
141         --sysconfdir=/etc/bacula \
142         --with-scriptdir=/etc/bacula \
143         --enable-smartalloc \
144         --enable-gnome \
145 %if %{mysql}
146         --with-mysql \
147 %else
148         --with-sqlite=${cwd}/../depkgs/sqlite \
149 %endif
150         --with-working-dir=/var/bacula \
151         --with-pid-dir=/var/run \
152         --with-subsys-dir=/var/lock/subsys
153 make
154
155 %install
156  
157 cwd=${PWD}
158 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
159 mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
160 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
161 mkdir -p $RPM_BUILD_ROOT/usr/share/gnome/apps/System
162 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
163
164 %if ! %{mysql}
165 mkdir -p $RPM_BUILD_ROOT/usr/lib/sqlite
166 %endif
167
168 make \
169         prefix=$RPM_BUILD_ROOT/usr \
170         sbindir=$RPM_BUILD_ROOT/usr/sbin \
171         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
172         scriptdir=$RPM_BUILD_ROOT/etc/bacula \
173         working_dir=$RPM_BUILD_ROOT/var/bacula \
174         install
175
176 cd %{depkgs}
177 make \
178         prefix=$RPM_BUILD_ROOT/usr \
179         sbindir=$RPM_BUILD_ROOT/usr/sbin \
180         sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
181         working_dir=$RPM_BUILD_ROOT/var/bacula \
182         mandir=$RPM_BUILD_ROOT/usr/man \
183         mtx-install
184 cd ${cwd}
185
186 %if ! %{mysql}
187 # fixme - make installs the mysql scripts for sqlite build
188 rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
189 rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
190 rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
191 %endif
192
193 # install the init scripts
194 cp platforms/redhat/bacula-dir $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
195 cp platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
196 cp platforms/redhat/bacula-sd $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-sd
197
198 # install the menu stuff
199 cp scripts/bacula.png $RPM_BUILD_ROOT/usr/share/pixmaps/bacula.png
200 cp scripts/bacula.desktop.gnome1 $RPM_BUILD_ROOT/usr/share/gnome/apps/System/bacula.desktop
201 cp scripts/bacula.desktop.gnome2 $RPM_BUILD_ROOT/usr/share/applications/bacula.desktop
202
203 # install sqlite
204 %if ! %{mysql}
205 cp ../depkgs/sqlite/sqlite $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite
206 cp ../depkgs/sqlite/sqlite.h $RPM_BUILD_ROOT/usr/lib/sqlite/sqlite.h
207 cp ../depkgs/sqlite/libsqlite.a $RPM_BUILD_ROOT/usr/lib/sqlite/libsqlite.a
208 %endif
209
210 # install the logrotate file
211 cp scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
212
213 %clean
214 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
215
216 %if %{mysql}
217
218 %files mysql-%{rh_version}
219 %defattr(-,root,root)
220
221 %attr(0754,root,root) /etc/bacula/bacula
222 %attr(0754,root,root) /etc/bacula/console
223 %attr(0754,root,root) /etc/bacula/fd
224 %attr(0754,root,root) /etc/bacula/gconsole
225 %attr(0754,root,root) /etc/bacula/create_mysql_database
226 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
227 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
228 %attr(0754,root,root) /etc/bacula/drop_mysql_tables
229 %attr(0754,root,root) /etc/bacula/make_bacula_tables
230 %attr(0754,root,root) /etc/bacula/make_catalog_backup
231 %attr(0754,root,root) /etc/bacula/make_mysql_tables
232 %attr(0754,root,root) /etc/bacula/grant_mysql_privileges
233 %attr(0754,root,root) /etc/bacula/startmysql
234 %attr(0754,root,root) /etc/bacula/stopmysql
235 %attr(0754,root,root) /etc/bacula/mtx-changer
236 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
237 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
238 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
239
240 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
241 %attr(0644,root,root) /usr/man/man1/*
242 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
243 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
244 %attr(0644,root,root) /usr/share/applications/bacula.desktop
245 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
246 %attr(0644,root,root) /etc/logrotate.d/bacula
247
248 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
249 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
250 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
251 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
252 %attr(0640,root,root) /etc/bacula/query.sql
253 %attr(0640,root,root) %dir /var/bacula
254
255 %attr(0750,root,root) /usr/sbin/*
256
257 %post mysql-%{rh_version}
258 # delete then add our links
259 /sbin/chkconfig --del bacula-dir
260 /sbin/chkconfig --del bacula-fd
261 /sbin/chkconfig --del bacula-sd
262 /sbin/chkconfig --add bacula-dir
263 /sbin/chkconfig --add bacula-fd
264 /sbin/chkconfig --add bacula-sd
265
266 # add execute permissions for console
267 chmod 0755 /usr/sbin/gnome-console
268
269 # grant privileges and create tables
270 # this will error out harmlessly if tables already exist
271 echo "Granting privileges for MySQL user bacula..."
272 /etc/bacula/grant_mysql_privileges
273 echo "Creating MySQL bacula database..."
274 /etc/bacula/create_mysql_database
275 echo "Creating bacula tables..."
276 /etc/bacula/make_mysql_tables
277
278 %preun mysql-%{rh_version}
279 # delete our links
280 /sbin/chkconfig --del bacula-dir
281 /sbin/chkconfig --del bacula-fd
282 /sbin/chkconfig --del bacula-sd
283
284 %else
285
286 %files sqlite-%{rh_version}
287 %defattr(-,root,root)
288
289 %attr(0754,root,root) /etc/bacula/bacula
290 %attr(0754,root,root) /etc/bacula/console
291 %attr(0754,root,root) /etc/bacula/fd
292 %attr(0754,root,root) /etc/bacula/gconsole
293 %attr(0754,root,root) /etc/bacula/create_sqlite_database
294 %attr(0754,root,root) /etc/bacula/delete_catalog_backup
295 %attr(0754,root,root) /etc/bacula/drop_bacula_tables
296 %attr(0754,root,root) /etc/bacula/drop_sqlite_tables
297 %attr(0754,root,root) /etc/bacula/make_bacula_tables
298 %attr(0754,root,root) /etc/bacula/make_catalog_backup
299 %attr(0754,root,root) /etc/bacula/make_sqlite_tables
300 %attr(0754,root,root) /etc/bacula/mtx-changer
301 %attr(0754,root,root) /etc/rc.d/init.d/bacula-dir
302 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
303 %attr(0754,root,root) /etc/rc.d/init.d/bacula-sd
304
305 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
306 %attr(0644,root,root) /usr/man/man1/*
307 %attr(0644,root,root) /usr/share/pixmaps/bacula.png
308 %attr(0644,root,root) /usr/share/gnome/apps/System/bacula.desktop
309 %attr(0644,root,root) /usr/share/applications/bacula.desktop
310 %attr(0644,root,root) %config(noreplace) /etc/bacula/gnome-console.conf
311 %attr(0644,root,root) /etc/logrotate.d/bacula
312
313 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-dir.conf
314 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
315 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-sd.conf
316 %attr(0640,root,root) %config(noreplace) /etc/bacula/console.conf
317 %attr(0640,root,root) /etc/bacula/query.sql
318 %attr(0640,root,root) /usr/lib/sqlite/libsqlite.a
319 %attr(0640,root,root) /usr/lib/sqlite/sqlite.h
320 %attr(0640,root,root) %dir /var/bacula
321
322 %attr(0750,root,root) /usr/sbin/*
323 %attr(0750,root,root) /usr/lib/sqlite/sqlite
324
325 %post sqlite-%{rh_version}
326 # delete then add our links
327 /sbin/chkconfig --del bacula-dir
328 /sbin/chkconfig --del bacula-fd
329 /sbin/chkconfig --del bacula-sd
330 /sbin/chkconfig --add bacula-dir
331 /sbin/chkconfig --add bacula-fd
332 /sbin/chkconfig --add bacula-sd
333
334 # add execute permission for console
335 chmod 0755 /usr/sbin/gnome-console
336
337 # create the tables
338 /etc/bacula/make_sqlite_tables
339
340 %preun sqlite-%{rh_version}
341 # delete our links
342 /sbin/chkconfig --del bacula-dir
343 /sbin/chkconfig --del bacula-fd
344 /sbin/chkconfig --del bacula-sd
345
346 %endif
347
348 %files client-%{rh_version}
349 %defattr(-,root,root)
350
351 %attr(0754,root,root) /etc/bacula/fd
352 %attr(0754,root,root) /etc/rc.d/init.d/bacula-fd
353
354 %attr(0644,root,root) %doc COPYING ChangeLog INSTALL README ReleaseNotes doc/*
355 %attr(0644,root,root) /etc/logrotate.d/bacula
356
357 %attr(0640,root,root) %config(noreplace) /etc/bacula/bacula-fd.conf
358 %attr(0640,root,root) %dir /var/bacula
359
360 %attr(0750,root,root) /usr/sbin/bacula-fd
361 %attr(0750,root,root) /usr/sbin/btraceback
362 %attr(0750,root,root) /usr/sbin/btraceback.gdb
363 %attr(0750,root,root) /usr/sbin/smtp
364
365
366 %post client-%{rh_version}
367 # delete then add our links
368 /sbin/chkconfig --del bacula-fd
369 /sbin/chkconfig --add bacula-fd
370
371 %preun client-%{rh_version}
372 # delete our links
373 /sbin/chkconfig --del bacula-fd
374
375 %changelog
376 * Fri Oct 24 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
377 - Added separate Source declaration for depkgs
378 - added patch for make_catalog_backup script
379 * Mon May 11 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
380 - Misc changes to mysql/sqlite build and rh7/8 menu differences
381 - Added rh_version to sub-package names
382 - Added installed but missing file /etc/bacula/gconsole
383 - rm'd /etc/bacula/grant_mysql_privileges on sqlite builds
384 * Thu May 08 2003 Kern Sibbald <kern at sibbald.com>
385 - Update spec for version 1.31 and combine client
386 * Sun Mar 30 2003 D. Scott Barninger <barninger at fairfieldcomputers.com>
387 - Initial spec file