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