| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- ##
- ## bacula.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
- ## Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # FIXME: rse: "odoc" support still not in final shape
- # package component versions
- %define V_bacula 1.37.40
- %define V_doc 20050823
- # package information
- Name: bacula
- Summary: Network Backup Tool
- URL: http://www.bacula.org/
- Vendor: Kern Sibbald
- Packager: OpenPKG
- Distribution: OpenPKG
- Class: EVAL
- Group: System
- License: GPL
- Version: %{V_bacula}
- Release: 20051001
- # package options
- %option with_server yes
- %option with_user %{l_rusr}
- %option with_group %{l_rgrp}
- %option with_ssl yes
- %option with_wrap no
- %option with_dvd no
- %option with_mtx no
- %option with_python no
- %option with_wxconsole no
- %option with_traymonitor no
- %option with_db_sqlite no
- %option with_db_pgsql no
- %option with_db_mysql no
- # package option sanity check
- %if "%{with_db_sqlite}" == "no" && "%{with_db_mysql}" == "no" && "%{with_db_pgsql}" == "no"
- %undefine with_db_sqlite
- %define with_db_sqlite yes
- %endif
- # list of sources
- Source0: http://osdn.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz
- Source1: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/bacula/bacula-doc-%{V_doc}.tar.gz
- Source2: rc.bacula
- Source3: bexec.sh
- Patch0: bacula.patch
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- BuildPreReq: OpenPKG, openpkg >= 20040712, gcc, odoc
- PreReq: OpenPKG, openpkg >= 20040712
- BuildPreReq: readline, zlib
- PreReq: readline, zlib
- %if "%{with_ssl}" == "yes"
- BuildPreReq: openssl >= 0.9.8
- PreReq: openssl >= 0.9.8
- %endif
- %if "%{with_wrap}" == "yes"
- BuildPreReq: tcpwrappers
- PreReq: tcpwrappers
- %endif
- %if "%{with_db_sqlite}" == "yes"
- BuildPreReq: sqlite
- PreReq: sqlite
- %endif
- %if "%{with_db_mysql}" == "yes"
- BuildPreReq: mysql
- PreReq: mysql
- %endif
- %if "%{with_db_pgsql}" == "yes"
- BuildPreReq: postgresql
- PreReq: postgresql
- %endif
- %if "%{with_dvd}" == "yes"
- BuildPreReq: dvdrw-tools
- PreReq: dvdrw-tools
- %endif
- %if "%{with_mtx}" == "yes"
- BuildPreReq: mtx
- PreReq: mtx
- %endif
- %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
- BuildPreReq: python
- PreReq: python
- %endif
- %if "%{with_wxconsole}" == "yes"
- BuildPreReq: wx
- PreReq: wx
- %endif
- %if "%{with_traymonitor}" == "yes"
- BuildPreReq: gtk2
- PreReq: gtk2
- %endif
- AutoReq: no
- AutoReqProv: no
- %description
- Bacula is a set of computer programs that permit you (or the system
- administrator) to manage backup, recovery, and verification of computer
- data across a network of computers of different kinds. In technical
- terms, it is a network client/server based backup program. Bacula is
- relatively easy to use and efficient, while offering many advanced
- storage management features that make it easy to find and recover
- lost or damaged files.
- %track
- prog bacula = {
- version = %{version}
- url = http://prdownloads.sourceforge.net/bacula/
- regex = bacula-(__VER__)\.tar\.gz
- }
- %prep
- %setup -q
- %setup -q -D -T -b 1
- %patch -p0
- rm src/lib/tcpd.h
- %build
- # delay generation of default passwords until installation, else
- # the config files change on every install leading _always_ to
- # the generation of .rpmnew files which prevent rc start/stop/restart
- for pwd in dir_password fd_password sd_password \
- mon_dir_password mon_fd_password mon_sd_password; do
- %{l_shtool} subst \
- -e "s;^s,@$pwd@,;s,@-$pwd-@,;" \
- configure
- done
- # for the same reason remove version informations from config files
- %{l_shtool} subst \
- -e "s;For Bacula release @VERSION@ .*;;" \
- `find . -name "*.conf.in"`
- # use localhost as default host
- %{l_shtool} subst \
- -e 's/s,@hostname@,$hostname,/s,@hostname@,localhost,/' \
- configure
- # configure
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- CPPFLAGS="%{l_cppflags}" \
- LDFLAGS="%{l_ldflags}" \
- ./configure \
- --prefix=%{l_prefix} \
- --with-dir-user=%{with_user} \
- --with-dir-group=%{with_group} \
- --with-sd-user=%{with_user} \
- --with-sd-group=%{with_group} \
- --with-fd-user=%{l_susr} \
- --with-fd-group=%{l_sgrp} \
- --disable-conio \
- --enable-readline \
- --with-readline=%{l_prefix} \
- %if "%{with_server}" == "no"
- --enable-client-only
- %endif
- %if "%{with_ssl}" == "yes"
- --with-openssl=%{l_prefix} \
- %endif
- %if "%{with_wrap}" == "yes"
- --with-tcp-wrappers=yes \
- %endif
- %if "%{with_db_sqlite}" == "yes"
- --with-sqlite=%{l_prefix} \
- %endif
- %if "%{with_db_mysql}" == "yes"
- --with-mysql=%{l_prefix} \
- %endif
- %if "%{with_db_pgsql}" == "yes"
- --with-postgresql=%{l_prefix} \
- %endif
- %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
- --with-python=%{l_prefix} \
- %endif
- %if "%{with_wxconsole}" == "yes"
- --enable-wx-console=yes \
- %endif
- --sysconfdir=%{l_prefix}/etc/bacula \
- --mandir=%{l_prefix}/man \
- --with-scriptdir=%{l_prefix}/libexec/bacula \
- --with-working-dir=%{l_prefix}/var/bacula \
- --with-pid-dir=%{l_prefix}/var/bacula/run \
- --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
- --disable-nls
- # build
- %{l_make} %{l_mflags -O}
- %install
- rm -rf $RPM_BUILD_ROOT
- # create installation hierarchy
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/bin \
- $RPM_BUILD_ROOT%{l_prefix}/sbin \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
- $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
- $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
- $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
- $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
- $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
- $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
- $RPM_BUILD_ROOT%{l_prefix}/share/bacula/docs \
- $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples \
- $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples/default-config \
- $RPM_BUILD_ROOT%{l_docdir}/bacula
- # install
- %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
- # strip down installation
- # do not strip binaries, to make it easier to diagnose problems
- # strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
- ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
- for unwanted in bconsole startmysql stopmysql; do
- rm -f $unwanted
- done
- ) || exit $?
- rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/bacula.8.gz
- # install additional files
- %{l_shtool} install -c -m 754 %{l_value -s -a} \
- %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
- # wrap binaries to avoid to specify "-c" for each run
- ( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
- for bin in bacula-dir bacula-fd bacula-sd \
- bconsole bcopy bextract bls bscan dbcheck \
- tray-monitor wx-console; do
- if [ -x $bin ]; then
- mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
- ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
- fi
- done
- ) || exit $?
- # install run-command script
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- -e 's,@with_server@,%{with_server},g' \
- %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # install documentation/examples
- %{l_shtool} install -c -m 644 \
- -e 's,/usr/share/doc/bacula-<version>,%{l_prefix}/doc/bacula,' \
- scripts/bacula.man $RPM_BUILD_ROOT%{l_prefix}/man/man8/bacula.8
- if %{l_odoc} -F; then
- echo "WARNING: will not package auxiliary documentation" 1>&2
- else
- mv ../bacula-doc-%{V_doc}/* $RPM_BUILD_ROOT%{l_docdir}/bacula/
- %{l_odoc} -ame %{_specdir}/bacula.spec
- fi
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%attr(700,%{with_user},%{with_group}) %{l_prefix}/var/bacula' \
- '%attr(700,%{with_user},%{with_group}) %{l_prefix}/var/bacula/run' \
- '%attr(700,%{with_user},%{with_group}) %{l_prefix}/var/bacula/run/subsys' \
- '%attr(-,-,%{with_group}) %{l_prefix}/libexec/bacula/dvd-freespace' \
- '%attr(-,-,%{with_group}) %{l_prefix}/libexec/bacula/dvd-writepart' \
- '%attr(-,-,%{with_group}) %{l_prefix}/libexec/bacula/mtx-changer' \
- '%attr(-,-,%{with_group}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
- '%attr(-,-,%{with_group}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\
- '%config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
- '%config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \
- '%config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
- '%config(noreplace) %{l_prefix}/etc/bacula/bconsole.conf' \
- '%attr(640,-,%{with_group}) %{l_prefix}/etc/bacula/bacula-sd.conf' \
- '%attr(640,-,-) %{l_prefix}/etc/bacula/bacula-fd.conf' \
- '%attr(640,-,%{with_group}) %{l_prefix}/etc/bacula/bacula-dir.conf' \
- '%attr(640,-,-) %{l_prefix}/etc/bacula/bconsole.conf' \
- %if "%{with_wxconsole}" == "yes"
- '%config(noreplace) %{l_prefix}/etc/bacula/wx-console.conf' \
- '%attr(640,-,-) %{l_prefix}/etc/bacula/wx-console.conf' \
- %endif
- %if "%{with_traymonitor}" == "yes"
- '%config(noreplace) %{l_prefix}/etc/bacula/tray-monitor.conf' \
- '%attr(640,-,-) %{l_prefix}/etc/bacula/tray-monitor.conf'
- %endif
- %files -f files
- %docdir %{l_docdir}
- %clean
- rm -rf $RPM_BUILD_ROOT
- %post
- # create initial database
- if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
- $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
- chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
- chown %{with_user}:%{with_group} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
- fi
- # generate default passwords
- for pwd in dir_password fd_password sd_password \
- mon_dir_password mon_fd_password mon_sd_password; do
- %{l_shtool} subst \
- -e "s;@$pwd@;`openssl rand -base64 33`;" \
- $RPM_INSTALL_PREFIX/etc/bacula/*.conf \
- $RPM_INSTALL_PREFIX/etc/bacula/*.conf.rpmnew 2>/dev/null
- done
- # after upgrade, restart service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} bacula status 2>/dev/null`
- [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
- exit 0
- %preun
- # before erase, stop service and remove working files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} bacula stop 2>/dev/null
- rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
- exit 0
|