bacula/bacula.spec

Wed, 08 Feb 2012 20:16:10 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:16:10 +0200
changeset 603
72fb5257eb82
parent 578
ac1eb2cd38a8
child 649
c44c510c1c7f
permissions
-rw-r--r--

Update version, adapt dependencies, and correct build configuration.

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

mercurial