Sat, 01 Sep 2012 12:17:10 +0200
Back out attempt to repair gets(3) redefinition and correct rather by
avoiding detection of gets(3) as a method with no macro, otherwise
leading to definition of HAVE_RAW_DECL_GETS and redefition of gets(3)
in lib/stdio.h(.in) caused by 'a split double-inclusion guard' and
a seemingly multiple '#include_next <stdio.h>' reference. Quatch.
1 ##
2 ## bacula.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2012 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 # MSvB: Note, see http://www.bacula.org/en/?page=news
25 # MSvB: for information on new configuration options.
28 # package information
29 Name: bacula
30 Summary: Network Backup Tool
31 URL: http://www.bacula.org/
32 Vendor: Kern Sibbald
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: PLUS
36 Group: System
37 License: GPL
38 Version: 5.2.10
39 Release: 20120800
41 # package options
42 %option with_server yes
43 %option with_ssl yes
44 %option with_wrap no
45 %option with_dvd no
46 %option with_mtx no
47 %option with_python no
48 %option with_db_sqlite no
49 %option with_db_pgsql no
50 %option with_db_mysql no
52 # package option sanity check
53 %if "%{with_db_sqlite}" == "no" && "%{with_db_mysql}" == "no" && "%{with_db_pgsql}" == "no"
54 %undefine with_db_sqlite
55 %define with_db_sqlite yes
56 %endif
58 # list of sources
59 Source0: http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz
60 Source1: rc.bacula
61 Source2: bexec.sh
62 Patch0: bacula.patch
64 # build information
65 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, gcc::with_cxx = yes
66 PreReq: OpenPKG, openpkg >= 20100101
67 BuildPreReq: ncurses, readline, zlib
68 PreReq: ncurses, readline, zlib
69 %if "%{with_ssl}" == "yes"
70 BuildPreReq: openssl >= 0.9.8, openssl::with_threads = yes
71 PreReq: openssl >= 0.9.8, openssl::with_threads = yes
72 %endif
73 %if "%{with_wrap}" == "yes"
74 BuildPreReq: tcpwrappers
75 PreReq: tcpwrappers
76 %endif
77 %if "%{with_db_sqlite}" == "yes"
78 BuildPreReq: sqlite
79 PreReq: sqlite
80 %endif
81 %if "%{with_db_mysql}" == "yes"
82 BuildPreReq: mysql
83 PreReq: mysql
84 %endif
85 %if "%{with_db_pgsql}" == "yes"
86 BuildPreReq: postgresql
87 PreReq: postgresql
88 %endif
89 %if "%{with_dvd}" == "yes"
90 BuildPreReq: dvdrw-tools
91 PreReq: dvdrw-tools
92 %endif
93 %if "%{with_mtx}" == "yes"
94 BuildPreReq: mtx
95 PreReq: mtx
96 %endif
97 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
98 BuildPreReq: python
99 PreReq: python
100 %endif
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://sourceforge.net/projects/bacula/files/
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
122 %{l_shtool} subst \
123 -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/findlib\);\2\1;g' \
124 -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/cats\);\2\1;g' \
125 -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/lib\);\2\1;g' \
126 src/stored/Makefile.in \
127 src/console/Makefile.in \
128 src/dird/Makefile.in \
129 src/filed/Makefile.in \
130 src/tools/Makefile.in \
131 src/tray-monitor/Makefile.in \
133 %build
134 # generate a random director password
135 #password=`tr -dc A-Za-z0-9 </dev/urandom | head -c 33`
136 password=`%{l_openssl} rand -base64 33`
138 # for the same reason remove version informations from config files
139 %{l_shtool} subst \
140 -e "s;For Bacula release @VERSION@ .*;;" \
141 `find . -name "*.conf.in"`
143 # help specific platforms find fdatasync(3)
144 libs=""
145 case "%{l_platform -t}" in
146 *-sunos* ) libs="-lrt" ;;
147 esac
149 # use localhost as default host
150 %{l_shtool} subst \
151 -e 's;hostname=.*;hostname=localhost;g' \
152 configure
154 # warning use of libtool(1) is defective in the case of static building.
155 # http://www.bacula.org/en/dev-manual/main/main/New_Features_in_5_2_1.html#SECTION006110000000000000000
156 # configure
157 LIBS=
158 case "%{l_platform -t}" in
159 *-sunos*) LIBS="-ldl" ;;
160 esac
161 CC="%{l_cc}" \
162 CFLAGS="%{l_cflags -O}" \
163 CPPFLAGS="%{l_cppflags ncurses}" \
164 LDFLAGS="%{l_ldflags} $LIBS" \
165 ./configure \
166 --prefix=%{l_prefix} \
167 --with-dir-user=%{l_rusr} \
168 --with-dir-group=%{l_rgrp} \
169 --with-sd-user=%{l_rusr} \
170 --with-sd-group=%{l_rgrp} \
171 --with-fd-user=%{l_susr} \
172 --with-fd-group=%{l_sgrp} \
173 --with-dir-password="$password" \
174 --with-fd-password="$password" \
175 --with-sd-password="$password" \
176 --with-mon-dir-password="$password" \
177 --with-mon-fd-password="$password" \
178 --with-mon-sd-password="$password" \
179 --disable-conio \
180 --enable-readline \
181 --with-readline=%{l_prefix} \
182 %if "%{with_server}" != "yes"
183 --enable-client-only \
184 %endif
185 %if "%{with_ssl}" == "yes"
186 --with-openssl=%{l_prefix} \
187 %endif
188 %if "%{with_wrap}" == "yes"
189 --with-tcp-wrappers=yes \
190 %endif
191 %if "%{with_db_sqlite}" == "yes"
192 --with-sqlite3=%{l_prefix} \
193 %endif
194 %if "%{with_db_mysql}" == "yes"
195 --with-mysql=%{l_prefix} \
196 %endif
197 %if "%{with_db_pgsql}" == "yes"
198 --with-postgresql=%{l_prefix} \
199 %endif
200 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
201 --with-python=%{l_prefix} \
202 %endif
203 --sysconfdir=%{l_prefix}/etc/bacula \
204 --mandir=%{l_prefix}/man \
205 --with-scriptdir=%{l_prefix}/libexec/bacula \
206 --with-working-dir=%{l_prefix}/var/bacula \
207 --with-pid-dir=%{l_prefix}/var/bacula/run \
208 --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
209 --with-archivedir=/tmp \
210 --with-sbin-perm=0755 \
211 --disable-libtool \
212 --disable-nls
214 # build
215 %{l_make} %{l_mflags -O}
217 %install
218 # create installation hierarchy
219 %{l_shtool} mkdir -f -p -m 755 \
220 $RPM_BUILD_ROOT%{l_prefix}/bin \
221 $RPM_BUILD_ROOT%{l_prefix}/sbin \
222 $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
223 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
224 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
225 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
226 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
227 $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
228 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
229 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
230 $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
231 $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
232 $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples \
233 $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples/default-config
235 # install
236 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
238 # strip down installation
239 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
240 ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
241 for unwanted in bconsole startmysql stopmysql; do
242 rm -f $unwanted
243 done
244 ) || exit $?
245 ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
246 rm -f bacula-bwxconsole.1 bacula-tray-monitor.1 bat.1
247 ) || exit $?
249 # install additional files
250 %{l_shtool} install -c -m 754 %{l_value -s -a} \
251 %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
253 ## wrap binaries to avoid specifying '-c' on each run
254 #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
255 # for bin in bacula-dir bacula-fd bacula-sd \
256 # bconsole bcopy bextract bls bscan dbcheck \
257 # tray-monitor wx-console; do
258 # if [ -x $bin ]; then
259 # mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
260 # ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
261 # fi
262 # done
263 #) || exit $?
265 # install runcommand script
266 %{l_shtool} install -c -m 755 %{l_value -s -a} \
267 -e 's,@with_server@,%{with_server},g' \
268 %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
270 # determine installation files
271 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
272 %{l_files_std} \
273 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula' \
274 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \
275 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \
276 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
277 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
278 %if "%{with_server}" == "yes"
279 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
280 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\
281 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
282 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
283 %endif
284 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \
285 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bconsole.conf' \
286 '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/clients' \
287 '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/scripts'
289 %files -f files
291 %clean
293 %post
294 # create initial database
295 %if "%{with_server}" == "yes"
296 if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
297 $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
298 chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
299 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
300 fi
301 %endif
303 # after upgrade, restart service
304 [ $1 -eq 2 ] || exit 0
305 eval `%{l_rc} bacula status 2>/dev/null`
306 [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
307 exit 0
309 %preun
310 # before erase, stop service and remove working files
311 [ $1 -eq 0 ] || exit 0
312 %{l_rc} bacula stop 2>/dev/null
313 rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
314 exit 0