bacula/bacula.spec

Wed, 07 Jan 2009 00:25:41 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 07 Jan 2009 00:25:41 +0100
changeset 20
8adc5213fd55
child 21
5ba5c2911c12
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

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

mercurial