bacula/bacula.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 661
5e372ee5f447
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     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:      20120800
    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:  ncurses, readline, zlib, lzo
    64 PreReq:       ncurses, readline, zlib, lzo
    65 %if "%{with_ssl}" == "yes"
    66 BuildPreReq:  openssl >= 0.9.8, openssl::with_threads = yes
    67 PreReq:       openssl >= 0.9.8, openssl::with_threads = yes
    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
   118     %{l_shtool} subst \
   119         -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/findlib\);\2\1;g' \
   120         -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/cats\);\2\1;g' \
   121         -e 's;\( *\$(LDFLAGS)\)\(.*-L\.\.\/lib\);\2\1;g' \
   122         src/stored/Makefile.in \
   123         src/console/Makefile.in \
   124         src/dird/Makefile.in \
   125         src/filed/Makefile.in \
   126         src/tools/Makefile.in \
   127         src/tray-monitor/Makefile.in \
   129 %build
   130     #   generate a random director password
   131     #password=`tr -dc A-Za-z0-9 </dev/urandom | head -c 33`
   132     password=`%{l_openssl} rand -base64 33`
   134     #   for the same reason remove version informations from config files
   135     %{l_shtool} subst \
   136         -e "s;For Bacula release @VERSION@ .*;;" \
   137         `find . -name "*.conf.in"`
   139     #   help specific platforms find fdatasync(3)
   140     libs=""
   141     case "%{l_platform -t}" in
   142         *-sunos* ) libs="-lrt" ;;
   143     esac
   145     #   use localhost as default host
   146     %{l_shtool} subst \
   147         -e 's;hostname=.*;hostname=localhost;g' \
   148         configure
   150     #   warning use of libtool(1) is defective in the case of static building.
   151     #   http://www.bacula.org/en/dev-manual/main/main/New_Features_in_5_2_1.html#SECTION006110000000000000000
   152     #   configure
   153     LIBS=
   154     case "%{l_platform -t}" in
   155         *-sunos*) LIBS="-ldl" ;;
   156     esac
   157     CC="%{l_cc}" \
   158     CFLAGS="%{l_cflags -O}" \
   159     CPPFLAGS="%{l_cppflags ncurses}" \
   160     LDFLAGS="%{l_ldflags} $LIBS" \
   161     ./configure \
   162         --prefix=%{l_prefix} \
   163         --with-dir-user=%{l_rusr} \
   164         --with-dir-group=%{l_rgrp} \
   165         --with-sd-user=%{l_rusr} \
   166         --with-sd-group=%{l_rgrp} \
   167         --with-fd-user=%{l_susr} \
   168         --with-fd-group=%{l_sgrp} \
   169         --with-dir-password="$password" \
   170         --with-fd-password="$password" \
   171         --with-sd-password="$password" \
   172         --with-mon-dir-password="$password" \
   173         --with-mon-fd-password="$password" \
   174         --with-mon-sd-password="$password" \
   175         --disable-conio \
   176         --enable-readline \
   177         --with-readline=%{l_prefix} \
   178 %if "%{with_server}" != "yes"
   179         --enable-client-only \
   180 %endif
   181 %if "%{with_ssl}" == "yes"
   182         --with-openssl=%{l_prefix} \
   183 %endif
   184 %if "%{with_wrap}" == "yes"
   185         --with-tcp-wrappers=yes \
   186 %endif
   187 %if "%{with_db_sqlite}" == "yes"
   188         --with-sqlite3=%{l_prefix} \
   189 %endif
   190 %if "%{with_db_mysql}" == "yes"
   191         --with-mysql=%{l_prefix} \
   192 %endif
   193 %if "%{with_db_pgsql}" == "yes"
   194         --with-postgresql=%{l_prefix} \
   195 %endif
   196 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
   197         --with-python=%{l_prefix} \
   198 %endif
   199         --sysconfdir=%{l_prefix}/etc/bacula \
   200         --mandir=%{l_prefix}/man \
   201         --with-scriptdir=%{l_prefix}/libexec/bacula \
   202         --with-working-dir=%{l_prefix}/var/bacula \
   203         --with-pid-dir=%{l_prefix}/var/bacula/run \
   204         --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
   205         --with-archivedir=/tmp \
   206         --with-sbin-perm=0755 \
   207         --disable-libtool \
   208         --disable-nls
   210     #   build
   211     %{l_make} %{l_mflags -O}
   213 %install
   214     #   create installation hierarchy
   215     %{l_shtool} mkdir -f -p -m 755 \
   216         $RPM_BUILD_ROOT%{l_prefix}/bin \
   217         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   218         $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
   219         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
   220         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
   221         $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
   222         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   223         $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
   224         $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
   225         $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
   226         $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
   227         $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
   228         $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples \
   229         $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples/default-config
   231     #   install
   232     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   234     #   strip down installation
   235     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   236     ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
   237       for unwanted in bconsole startmysql stopmysql; do
   238           rm -f $unwanted
   239       done
   240     ) || exit $?
   241     ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
   242       rm -f bacula-bwxconsole.1 bacula-tray-monitor.1 bat.1
   243     ) || exit $?
   245     #   install additional files
   246     %{l_shtool} install -c -m 754 %{l_value -s -a} \
   247         %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
   249     ##   wrap binaries to avoid specifying '-c' on each run
   250     #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
   251     #  for bin in bacula-dir bacula-fd bacula-sd \
   252     #             bconsole bcopy bextract bls bscan dbcheck \
   253     #             tray-monitor wx-console; do
   254     #      if [ -x $bin ]; then
   255     #          mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
   256     #          ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
   257     #      fi
   258     #  done
   259     #) || exit $?
   261     #   install runcommand script
   262     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   263         -e 's,@with_server@,%{with_server},g' \
   264         %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   266     #   determine installation files
   267     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   268         %{l_files_std} \
   269         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula' \
   270         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \
   271         '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \
   272         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
   273         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
   274 %if "%{with_server}" == "yes"
   275         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
   276         '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\
   277         '%config(noreplace) %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-dir.conf' \
   278         '%config(noreplace) %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-sd.conf' \
   279 %endif                      
   280         '%config(noreplace) %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-fd.conf' \
   281         '%config(noreplace) %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bconsole.conf' \
   282         '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/clients' \
   283         '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/scripts'
   285 %files -f files
   287 %clean
   289 %post
   290     #   create initial database
   291 %if "%{with_server}" == "yes"
   292     if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
   293         $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
   294         chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   295         chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   296     fi
   297 %endif
   299     #   after upgrade, restart service
   300     [ $1 -eq 2 ] || exit 0
   301     eval `%{l_rc} bacula status 2>/dev/null`
   302     [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
   303     exit 0
   305 %preun
   306     #   before erase, stop service and remove working files
   307     [ $1 -eq 0 ] || exit 0
   308     %{l_rc} bacula stop 2>/dev/null
   309     rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
   310     exit 0

mercurial