bacula/bacula.spec

changeset 603
72fb5257eb82
parent 578
ac1eb2cd38a8
child 649
c44c510c1c7f
equal deleted inserted replaced
7:90922babfe99 8:fd2e00583bc4
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 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 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE. 21 ## SUCH DAMAGE.
22 ## 22 ##
23 23
24 # MSvB:
25 # MSvB: Note, see http://www.bacula.org/en/?page=news
26 # MSvB: for information on new configuration options.
27 # MSvB: Warning! -L /pfx/lib is placed before locally
28 # MSvB: built libraries (bacula-<ver>/src/cats...)
29 # MSvB: which causes the old version of bacula to
30 # MSvB: supply logic to the new version build!
31 # MSvB:
32
24 # package information 33 # package information
25 Name: bacula 34 Name: bacula
26 Summary: Network Backup Tool 35 Summary: Network Backup Tool
27 URL: http://www.bacula.org/ 36 URL: http://www.bacula.org/
28 Vendor: Kern Sibbald 37 Vendor: Kern Sibbald
30 Distribution: OpenPKG Community 39 Distribution: OpenPKG Community
31 Class: PLUS 40 Class: PLUS
32 Group: System 41 Group: System
33 License: GPL 42 License: GPL
34 Version: 5.2.10 43 Version: 5.2.10
35 Release: 20120629 44 Release: 20120800
36 45
37 # package options 46 # package options
38 %option with_server yes 47 %option with_server yes
39 %option with_ssl yes 48 %option with_ssl yes
40 %option with_wrap no 49 %option with_wrap no
58 Patch0: bacula.patch 67 Patch0: bacula.patch
59 68
60 # build information 69 # build information
61 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, gcc::with_cxx = yes 70 BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, gcc::with_cxx = yes
62 PreReq: OpenPKG, openpkg >= 20100101 71 PreReq: OpenPKG, openpkg >= 20100101
63 BuildPreReq: readline, zlib 72 BuildPreReq: ncurses, readline, zlib
64 PreReq: readline, zlib 73 PreReq: ncurses, readline, zlib
65 %if "%{with_ssl}" == "yes" 74 %if "%{with_ssl}" == "yes"
66 BuildPreReq: openssl >= 0.9.8 75 BuildPreReq: openssl >= 0.9.8, openssl::with_threads = yes
67 PreReq: openssl >= 0.9.8 76 PreReq: openssl >= 0.9.8, openssl::with_threads = yes
68 %endif 77 %endif
69 %if "%{with_wrap}" == "yes" 78 %if "%{with_wrap}" == "yes"
70 BuildPreReq: tcpwrappers 79 BuildPreReq: tcpwrappers
71 PreReq: tcpwrappers 80 PreReq: tcpwrappers
72 %endif 81 %endif
116 %patch -p0 125 %patch -p0
117 rm -f src/lib/tcpd.h 126 rm -f src/lib/tcpd.h
118 127
119 %build 128 %build
120 # generate a random director password 129 # generate a random director password
121 password="`openssl rand -base64 33`" 130 #password=`tr -dc A-Za-z0-9 </dev/urandom | head -c 33`
131 password=`%{l_openssl} rand -base64 33`
122 132
123 # for the same reason remove version informations from config files 133 # for the same reason remove version informations from config files
124 %{l_shtool} subst \ 134 %{l_shtool} subst \
125 -e "s;For Bacula release @VERSION@ .*;;" \ 135 -e "s;For Bacula release @VERSION@ .*;;" \
126 `find . -name "*.conf.in"` 136 `find . -name "*.conf.in"`
127 137
138 # help specific platforms find fdatasync(3)
139 libs=""
140 case "%{l_platform -t}" in
141 *-sunos* ) libs="-lrt" ;;
142 esac
143
128 # use localhost as default host 144 # use localhost as default host
129 %{l_shtool} subst \ 145 %{l_shtool} subst \
130 -e 's;hostname=.*;hostname=localhost;g' \ 146 -e 's;hostname=.*;hostname=localhost;g' \
131 configure 147 configure
132 148
133 # configure 149 # configure
134 LIBS= 150 LIBS=
135 case "%{l_platform -t}" in 151 case "%{l_platform -t}" in
136 *-linux*) LIBS="-L/usr/lib/termcap";; 152 *-sunos*) LIBS="-ldl" ;;
137 esac 153 esac
138 CC="%{l_cc}" \ 154 CC="%{l_cc}" \
139 CFLAGS="%{l_cflags -O}" \ 155 CFLAGS="%{l_cflags -O}" \
140 CPPFLAGS="%{l_cppflags}" \ 156 CPPFLAGS="%{l_cppflags ncurses}" \
141 LDFLAGS="%{l_ldflags} $LIBS" \ 157 LDFLAGS="%{l_ldflags} $LIBS" \
142 ./configure \ 158 ./configure \
143 --prefix=%{l_prefix} \ 159 --prefix=%{l_prefix} \
144 --with-dir-user=%{l_rusr} \ 160 --with-dir-user=%{l_rusr} \
145 --with-dir-group=%{l_rgrp} \ 161 --with-dir-group=%{l_rgrp} \
175 --with-postgresql=%{l_prefix} \ 191 --with-postgresql=%{l_prefix} \
176 %endif 192 %endif
177 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes" 193 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
178 --with-python=%{l_prefix} \ 194 --with-python=%{l_prefix} \
179 %endif 195 %endif
180 --enable-wx-console=no \
181 --sysconfdir=%{l_prefix}/etc/bacula \ 196 --sysconfdir=%{l_prefix}/etc/bacula \
182 --mandir=%{l_prefix}/man \ 197 --mandir=%{l_prefix}/man \
183 --with-scriptdir=%{l_prefix}/libexec/bacula \ 198 --with-scriptdir=%{l_prefix}/libexec/bacula \
184 --with-working-dir=%{l_prefix}/var/bacula \ 199 --with-working-dir=%{l_prefix}/var/bacula \
185 --with-pid-dir=%{l_prefix}/var/bacula/run \ 200 --with-pid-dir=%{l_prefix}/var/bacula/run \
186 --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \ 201 --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
202 --with-archivedir=/tmp \
203 --with-sbin-perm=0755 \
204 --disable-shared \
187 --disable-nls 205 --disable-nls
188 206
189 # build 207 # build
190 %{l_make} %{l_mflags -O} 208 %{l_make} %{l_mflags -O}
191 209
192 %install 210 %install
193
194 # create installation hierarchy 211 # create installation hierarchy
195 %{l_shtool} mkdir -f -p -m 755 \ 212 %{l_shtool} mkdir -f -p -m 755 \
196 $RPM_BUILD_ROOT%{l_prefix}/bin \ 213 $RPM_BUILD_ROOT%{l_prefix}/bin \
197 $RPM_BUILD_ROOT%{l_prefix}/sbin \ 214 $RPM_BUILD_ROOT%{l_prefix}/sbin \
198 $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \ 215 $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
210 227
211 # install 228 # install
212 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 229 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
213 230
214 # strip down installation 231 # strip down installation
215 # do not strip binaries, to make it easier to diagnose problems 232 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
216 # strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
217 ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula && 233 ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
218 for unwanted in bconsole startmysql stopmysql; do 234 for unwanted in bconsole startmysql stopmysql; do
219 rm -f $unwanted 235 rm -f $unwanted
220 done 236 done
221 ) || exit $? 237 ) || exit $?
222 238
223 # install additional files 239 # install additional files
224 %{l_shtool} install -c -m 754 %{l_value -s -a} \ 240 %{l_shtool} install -c -m 754 %{l_value -s -a} \
225 %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec 241 %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
226 242
227 # wrap binaries to avoid to specify "-c" for each run 243 ## wrap binaries to avoid specifying '-c' on each run
228 ( cd $RPM_BUILD_ROOT%{l_prefix}/sbin 244 #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
229 for bin in bacula-dir bacula-fd bacula-sd \ 245 # for bin in bacula-dir bacula-fd bacula-sd \
230 bconsole bcopy bextract bls bscan dbcheck \ 246 # bconsole bcopy bextract bls bscan dbcheck \
231 tray-monitor wx-console; do 247 # tray-monitor wx-console; do
232 if [ -x $bin ]; then 248 # if [ -x $bin ]; then
233 mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula 249 # mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
234 ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin 250 # ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
235 fi 251 # fi
236 done 252 # done
237 ) || exit $? 253 #) || exit $?
238 254
239 # install run-command script 255 # install runcommand script
240 %{l_shtool} install -c -m 755 %{l_value -s -a} \ 256 %{l_shtool} install -c -m 755 %{l_value -s -a} \
241 -e 's,@with_server@,%{with_server},g' \ 257 -e 's,@with_server@,%{with_server},g' \
242 %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 258 %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
243 259
244 # determine installation files 260 # determine installation files
250 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \ 266 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
251 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \ 267 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
252 %if "%{with_server}" == "yes" 268 %if "%{with_server}" == "yes"
253 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \ 269 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
254 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\ 270 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\
255 '%config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \ 271 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
256 '%config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \ 272 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
257 %endif 273 %endif
258 '%config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \ 274 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \
259 %if "%{with_server}" == "yes" 275 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bconsole.conf' \
260 '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-dir.conf' \ 276 '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/clients' \
261 '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-sd.conf' \ 277 '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/scripts'
262 %endif
263 '%attr(640,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/bacula/bacula-fd.conf'
264 278
265 %files -f files 279 %files -f files
266 280
267 %clean 281 %clean
268 282
269 %post 283 %post
270 # create initial database 284 # create initial database
285 %if "%{with_server}" == "yes"
271 if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then 286 if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
272 $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables 287 $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
273 chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db 288 chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
274 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db 289 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
275 fi 290 fi
291 %endif
276 292
277 # after upgrade, restart service 293 # after upgrade, restart service
278 [ $1 -eq 2 ] || exit 0 294 [ $1 -eq 2 ] || exit 0
279 eval `%{l_rc} bacula status 2>/dev/null` 295 eval `%{l_rc} bacula status 2>/dev/null`
280 [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart 296 [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart

mercurial