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