Mon, 20 Apr 2009 19:23:01 +0200
Add fingerprints config for client certificate based authentication.
1 ##
2 ## bacula.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package information
25 Name: bacula
26 Summary: Network Backup Tool
27 URL: http://www.bacula.org/
28 Vendor: Kern Sibbald
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: PLUS
32 Group: System
33 License: GPL
34 Version: 2.4.4
35 Release: 20090405
37 # package options
38 %option with_server yes
39 %option with_ssl yes
40 %option with_wrap no
41 %option with_dvd no
42 %option with_mtx no
43 %option with_python no
44 %option with_db_sqlite no
45 %option with_db_pgsql no
46 %option with_db_mysql no
48 # package option sanity check
49 %if "%{with_db_sqlite}" == "no" && "%{with_db_mysql}" == "no" && "%{with_db_pgsql}" == "no"
50 %undefine with_db_sqlite
51 %define with_db_sqlite yes
52 %endif
54 # list of sources
55 Source0: http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz
56 Source1: rc.bacula
57 Source2: bexec.sh
58 Patch0: bacula.patch
60 # build information
61 Prefix: %{l_prefix}
62 BuildRoot: %{l_buildroot}
63 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes
64 PreReq: OpenPKG, openpkg >= 20060823
65 BuildPreReq: ncurses, readline, zlib
66 PreReq: ncurses, readline, zlib
67 %if "%{with_ssl}" == "yes"
68 BuildPreReq: openssl >= 0.9.8
69 PreReq: openssl >= 0.9.8
70 %endif
71 %if "%{with_wrap}" == "yes"
72 BuildPreReq: tcpwrappers
73 PreReq: tcpwrappers
74 %endif
75 %if "%{with_db_sqlite}" == "yes"
76 BuildPreReq: sqlite
77 PreReq: sqlite
78 %endif
79 %if "%{with_db_mysql}" == "yes"
80 BuildPreReq: mysql
81 PreReq: mysql
82 %endif
83 %if "%{with_db_pgsql}" == "yes"
84 BuildPreReq: postgresql
85 PreReq: postgresql
86 %endif
87 %if "%{with_dvd}" == "yes"
88 BuildPreReq: dvdrw-tools
89 PreReq: dvdrw-tools
90 %endif
91 %if "%{with_mtx}" == "yes"
92 BuildPreReq: mtx
93 PreReq: mtx
94 %endif
95 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
96 BuildPreReq: python
97 PreReq: python
98 %endif
99 AutoReq: no
100 AutoReqProv: no
102 %description
103 Bacula is a set of computer programs that permit you (or the system
104 administrator) to manage backup, recovery, and verification of
105 computer data across a network of computers of different kinds. In
106 technical terms, it is a network client/server based backup program.
107 Bacula is relatively easy to use and efficient, while offering many
108 advanced storage management features that make it easy to find and
109 recover lost or damaged files.
111 %track
112 prog bacula = {
113 version = %{version}
114 url = http://prdownloads.sourceforge.net/bacula/
115 regex = bacula-(\d+\.\d*[02468]\.\d+)\.tar\.gz
116 }
118 %prep
119 %setup -q
120 %patch -p0
121 rm -f src/lib/tcpd.h
123 %build
124 # generate a random director password
125 password="`openssl rand -base64 33`"
127 # for the same reason remove version informations from config files
128 %{l_shtool} subst \
129 -e "s;For Bacula release @VERSION@ .*;;" \
130 `find . -name "*.conf.in"`
132 # help specific platforms find fdatasync(3)
133 libs=""
134 case "%{l_platform -t}" in
135 *-sunos* ) libs="-lrt" ;;
136 esac
138 # use localhost as default host
139 %{l_shtool} subst \
140 -e 's;hostname=.*;hostname=localhost;g' \
141 -e 's;\(CONS_LIBS="-lreadline.*\)-ltermcap;\1-lncurses;g' \
142 configure
144 # configure
145 LIBS=
146 case "%{l_platform -t}" in
147 *-linux*) LIBS="-L/usr/lib/termcap";;
148 esac
149 CC="%{l_cc}" \
150 CFLAGS="%{l_cflags -O}" \
151 CPPFLAGS="%{l_cppflags ncurses}" \
152 LDFLAGS="%{l_ldflags} $LIBS" \
153 LIBS="$libs" \
154 GREP="grep" \
155 ./configure \
156 --prefix=%{l_prefix} \
157 --with-dir-user=%{l_rusr} \
158 --with-dir-group=%{l_rgrp} \
159 --with-sd-user=%{l_rusr} \
160 --with-sd-group=%{l_rgrp} \
161 --with-fd-user=%{l_susr} \
162 --with-fd-group=%{l_sgrp} \
163 --with-dir-password="$password" \
164 --with-fd-password="$password" \
165 --with-sd-password="$password" \
166 --with-mon-dir-password="$password" \
167 --with-mon-fd-password="$password" \
168 --with-mon-sd-password="$password" \
169 --disable-conio \
170 --enable-readline \
171 --with-readline=%{l_prefix} \
172 %if "%{with_server}" != "yes"
173 --enable-client-only \
174 %endif
175 %if "%{with_ssl}" == "yes"
176 --with-openssl=%{l_prefix} \
177 %endif
178 %if "%{with_wrap}" == "yes"
179 --with-tcp-wrappers=yes \
180 %endif
181 %if "%{with_db_sqlite}" == "yes"
182 --with-sqlite3=%{l_prefix} \
183 %endif
184 %if "%{with_db_mysql}" == "yes"
185 --with-mysql=%{l_prefix} \
186 %endif
187 %if "%{with_db_pgsql}" == "yes"
188 --with-postgresql=%{l_prefix} \
189 %endif
190 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
191 --with-python=%{l_prefix} \
192 %endif
193 --enable-wx-console=no \
194 --sysconfdir=%{l_prefix}/etc/bacula \
195 --libexecdir=%{l_prefix}/libexec/bacula \
196 --mandir=%{l_prefix}/man \
197 --with-scriptdir=%{l_prefix}/libexec/bacula \
198 --with-working-dir=%{l_prefix}/var/bacula \
199 --with-pid-dir=%{l_prefix}/var/bacula/run \
200 --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
201 --with-archivedir=/tmp \
202 --with-sbin-perm=0755 \
203 --disable-nls
205 # build
206 %{l_make} %{l_mflags -O}
208 %install
209 rm -rf $RPM_BUILD_ROOT
211 # create installation hierarchy
212 %{l_shtool} mkdir -f -p -m 755 \
213 $RPM_BUILD_ROOT%{l_prefix}/bin \
214 $RPM_BUILD_ROOT%{l_prefix}/sbin \
215 $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
216 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
217 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
218 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
219 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
220 $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
221 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
222 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
223 $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
224 $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
225 $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples \
226 $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples/default-config
228 # install
229 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
231 # strip down installation
232 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
233 ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
234 for unwanted in startmysql stopmysql; do
235 rm -f $unwanted
236 done
237 ) || exit $?
239 # install additional files
240 %{l_shtool} install -c -m 754 %{l_value -s -a} \
241 %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
242 %{l_shtool} install -c -m 640 \
243 src/console/bconsole.conf $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/
245 ## wrap binaries to avoid to specify "-c" for each run
246 #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
247 # for bin in bacula-dir bacula-fd bacula-sd \
248 # bconsole bcopy bextract bls bscan dbcheck \
249 # tray-monitor wx-console; do
250 # if [ -x $bin ]; then
251 # mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
252 # ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
253 # fi
254 # done
255 #) || exit $?
257 # install runcommand script
258 %{l_shtool} install -c -m 755 %{l_value -s -a} \
259 -e 's,@with_server@,%{with_server},g' \
260 %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
262 # determine installation files
263 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
264 %{l_files_std} \
265 '%config(noreplace) %{l_prefix}/etc/bacula/*.conf' \
266 %if "%{with_server}" == "yes"
267 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
268 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
269 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup' \
270 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
271 %endif
272 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
273 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
274 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \
275 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \
276 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula'
278 %files -f files
280 %clean
281 rm -rf $RPM_BUILD_ROOT
283 %post
284 # create initial database
285 if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
286 $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
287 chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
288 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
289 fi
291 # after upgrade, restart service
292 [ $1 -eq 2 ] || exit 0
293 eval `%{l_rc} bacula status 2>/dev/null`
294 [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
295 exit 0
297 %preun
298 # before erase, stop service and remove working files
299 [ $1 -eq 0 ] || exit 0
300 %{l_rc} bacula stop 2>/dev/null
301 rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
302 exit 0