bacula/bacula.spec

Wed, 08 Feb 2012 20:15:50 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:15:50 +0200
changeset 602
6b1bca241155
parent 578
ac1eb2cd38a8
child 649
c44c510c1c7f
permissions
-rw-r--r--

Update source URI to canonical location.

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

mercurial