bacula/bacula.spec

Sat, 03 Oct 2009 16:18:52 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Oct 2009 16:18:52 +0200
changeset 220
a6cd892638c1
parent 143
5479ddead00b
child 223
d1b7fc7f844a
permissions
-rw-r--r--

Update version, adjust corresponding buildconf, and correct logic.
1: Make minor corrections and improvements to scripts patch logic.
2: Upgrade to most recent stable release version 3.0.2.
3: Force selection of a single db backend, as multiple ones never
were supported (changing 'with_db<end>' identifiers accordingly.)
4: Unfortunately add gawk requirement although only partly needed.
5: Add openssl::with_threads requirement to solve strange and hard
to debug problems on Solaris leading to connection failures:

'host-dir JobId 0: Error: openssl.c:86 Connect failure: ERR=error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number'

and

'host-dir JobId 40: Fatal error: TLS negotiation failed with FD at "back1.host.com:9102"'

     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 # MSvB:
    25 # MSvB: Note, see http://www.bacula.org/en/?page=news
    26 # MSvB: for information on new configuration options.
    27 # MSvB:
    29 #   package information
    30 Name:         bacula
    31 Summary:      Network Backup Tool
    32 URL:          http://www.bacula.org/
    33 Vendor:       Kern Sibbald
    34 Packager:     OpenPKG Foundation e.V.
    35 Distribution: OpenPKG Community
    36 Class:        PLUS
    37 Group:        System
    38 License:      GPL
    39 Version:      3.0.2
    40 Release:      20090916
    42 #   package options
    43 %option       with_server       yes
    44 %option       with_ssl          yes
    45 %option       with_wrap         no
    46 %option       with_dvd          no
    47 %option       with_mtx          no
    48 %option       with_python       no
    49 %option       with_dbback       sqlite
    51 #   list of sources
    52 Source0:      http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz
    53 Source1:      rc.bacula
    54 Source2:      bexec.sh
    55 Patch0:       bacula.patch
    57 #   build information
    58 Prefix:       %{l_prefix}
    59 BuildRoot:    %{l_buildroot}
    60 BuildPreReq:  OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes
    61 PreReq:       OpenPKG, openpkg >= 20060823
    62 BuildPreReq:  ncurses, readline, zlib, gawk
    63 PreReq:       ncurses, readline, zlib, gawk
    64 %if "%{with_ssl}" == "yes"
    65 BuildPreReq:  openssl >= 0.9.8, openssl::with_threads = yes
    66 PreReq:       openssl >= 0.9.8, openssl::with_threads = yes
    67 %endif
    68 %if "%{with_wrap}" == "yes"
    69 BuildPreReq:  tcpwrappers
    70 PreReq:       tcpwrappers
    71 %endif
    72 %if "%{with_dbback}" == "sqlite"
    73 BuildPreReq:  sqlite
    74 PreReq:       sqlite
    75 %endif
    76 %if "%{with_dbback}" == "mysql"
    77 BuildPreReq:  mysql
    78 PreReq:       mysql
    79 %endif
    80 %if "%{with_dbback}" == "postgresql"
    81 BuildPreReq:  postgresql
    82 PreReq:       postgresql
    83 %endif
    84 %if "%{with_dvd}" == "yes"
    85 BuildPreReq:  dvdrw-tools
    86 PreReq:       dvdrw-tools
    87 %endif
    88 %if "%{with_mtx}" == "yes"
    89 BuildPreReq:  mtx
    90 PreReq:       mtx
    91 %endif
    92 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
    93 BuildPreReq:  python
    94 PreReq:       python
    95 %endif
    96 AutoReq:      no
    97 AutoReqProv:  no
    99 %description
   100     Bacula is a set of computer programs that permit you (or the system
   101     administrator) to manage backup, recovery, and verification of
   102     computer data across a network of computers of different kinds. In
   103     technical terms, it is a network client/server based backup program.
   104     Bacula is relatively easy to use and efficient, while offering many
   105     advanced storage management features that make it easy to find and
   106     recover lost or damaged files.
   108 %track
   109     prog bacula = {
   110         version   = %{version}
   111         url       = http://prdownloads.sourceforge.net/bacula/
   112         regex     = bacula-(\d+\.\d*[02468]\.\d+)\.tar\.gz
   113     }
   115 %prep
   116     %setup -q
   117     %patch -p0
   118     rm -f src/lib/tcpd.h
   120 %build
   121     #   generate a random director password
   122     password="`openssl rand -base64 33`"
   124     #   for the same reason remove version informations from config files
   125     %{l_shtool} subst \
   126         -e "s;For Bacula release @VERSION@ .*;;" \
   127         `find . -name "*.conf.in"`
   129     #   help specific platforms find fdatasync(3)
   130     libs=""
   131     case "%{l_platform -t}" in
   132         *-sunos* ) libs="-lrt" ;;
   133     esac
   135     #   use localhost as default host
   136     %{l_shtool} subst \
   137         -e 's;hostname=.*;hostname=localhost;g' \
   138         -e 's;\(CONS_LIBS="-lreadline.*\)-ltermcap;\1-lncurses;g' \
   139         configure
   141     #   configure
   142     LIBS=
   143     case "%{l_platform -t}" in
   144         *-linux*) LIBS="-L/usr/lib/termcap";;
   145     esac
   146     CC="%{l_cc}" \
   147     CFLAGS="%{l_cflags -O}" \
   148     CPPFLAGS="%{l_cppflags ncurses}" \
   149     LDFLAGS="%{l_ldflags} $LIBS" \
   150     LIBS="$libs" \
   151     GREP="grep" \
   152     ./configure \
   153         --prefix=%{l_prefix} \
   154         --with-dir-user=%{l_rusr} \
   155         --with-dir-group=%{l_rgrp} \
   156         --with-sd-user=%{l_rusr} \
   157         --with-sd-group=%{l_rgrp} \
   158         --with-fd-user=%{l_susr} \
   159         --with-fd-group=%{l_sgrp} \
   160         --with-dir-password="$password" \
   161         --with-fd-password="$password" \
   162         --with-sd-password="$password" \
   163         --with-mon-dir-password="$password" \
   164         --with-mon-fd-password="$password" \
   165         --with-mon-sd-password="$password" \
   166         --disable-conio \
   167         --enable-readline \
   168         --with-readline=%{l_prefix} \
   169 %if "%{with_server}" != "yes"
   170         --enable-client-only \
   171 %endif
   172 %if "%{with_ssl}" == "yes"
   173         --with-openssl=%{l_prefix} \
   174 %endif
   175 %if "%{with_wrap}" == "yes"
   176         --with-tcp-wrappers=yes \
   177 %endif
   178 %if "%{with_dbback}" == "sqlite"
   179         --with-sqlite3=%{l_prefix} \
   180 %endif
   181 %if "%{with_dbback}" == "mysql"
   182         --with-mysql=%{l_prefix} \
   183 %endif
   184 %if "%{with_dbback}" == "postgresql"
   185         --with-postgresql=%{l_prefix} \
   186 %endif
   187 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
   188         --with-python=%{l_prefix} \
   189 %endif
   190         --enable-wx-console=no \
   191         --sysconfdir=%{l_prefix}/etc/bacula \
   192         --libexecdir=%{l_prefix}/libexec/bacula \
   193         --mandir=%{l_prefix}/man \
   194         --with-scriptdir=%{l_prefix}/libexec/bacula \
   195         --with-working-dir=%{l_prefix}/var/bacula \
   196         --with-pid-dir=%{l_prefix}/var/bacula/run \
   197         --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
   198         --with-archivedir=/tmp \
   199         --with-sbin-perm=0755 \
   200         --disable-libtool \
   201         --disable-nls
   203     #   build
   204     %{l_make} %{l_mflags -O}
   206 %install
   207     rm -rf $RPM_BUILD_ROOT
   209     #   create installation hierarchy
   210     %{l_shtool} mkdir -f -p -m 755 \
   211         $RPM_BUILD_ROOT%{l_prefix}/bin \
   212         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   213         $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
   214         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
   215         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
   216         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
   217         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   218         $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
   219         $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
   220         $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
   221         $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
   222         $RPM_BUILD_ROOT%{l_prefix}/man/man8
   224     #   install
   225     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   227     #   strip down installation
   228     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   229     ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
   230       for unwanted in startmysql stopmysql; do
   231           rm -f $unwanted
   232       done
   233     ) || exit $?
   235     #   install additional files
   236     %{l_shtool} install -c -m 754 %{l_value -s -a} \
   237         %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
   238     %{l_shtool} install -c -m 640 \
   239         src/console/bconsole.conf $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/
   241     ##   wrap binaries to avoid to specify "-c" for each run
   242     #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
   243     #  for bin in bacula-dir bacula-fd bacula-sd \
   244     #             bconsole bcopy bextract bls bscan dbcheck \
   245     #             tray-monitor wx-console; do
   246     #      if [ -x $bin ]; then
   247     #          mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
   248     #          ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
   249     #      fi
   250     #  done
   251     #) || exit $?
   253     #   install runcommand script
   254     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   255         -e 's,@with_server@,%{with_server},g' \
   256         %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   258     #   determine installation files
   259     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   260         %{l_files_std} \
   261         '%config(noreplace) %{l_prefix}/etc/bacula/*.conf' \
   262 %if "%{with_server}" == "yes"
   263         '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
   264         '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
   265         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup' \
   266         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
   267 %endif
   268         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
   269         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
   270         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \
   271         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \
   272         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula'
   274 %files -f files
   276 %clean
   277     rm -rf $RPM_BUILD_ROOT
   279 %post
   280     #   create initial database
   281     if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
   282         $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
   283         chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   284         chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   285     fi
   287     #   after upgrade, restart service
   288     [ $1 -eq 2 ] || exit 0
   289     eval `%{l_rc} bacula status 2>/dev/null`
   290     [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
   291     exit 0
   293 %preun
   294     #   before erase, stop service and remove working files
   295     [ $1 -eq 0 ] || exit 0
   296     %{l_rc} bacula stop 2>/dev/null
   297     rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
   298     exit 0

mercurial