bacula/bacula.spec

Tue, 28 Aug 2012 18:36:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:30 +0200
changeset 578
ac1eb2cd38a8
parent 577
e3c6a8f912f4
child 579
6b18bb69901e
permissions
-rw-r--r--

Resynchronize with upstream package maintainer version.

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

mercurial