michael@20: ## michael@20: ## bacula.spec -- OpenPKG RPM Package Specification michael@20: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. michael@20: ## michael@20: ## Permission to use, copy, modify, and distribute this software for michael@20: ## any purpose with or without fee is hereby granted, provided that michael@20: ## the above copyright notice and this permission notice appear in all michael@20: ## copies. michael@20: ## michael@20: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@20: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@20: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@20: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@20: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@20: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@20: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@20: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@20: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@20: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@20: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@20: ## SUCH DAMAGE. michael@20: ## michael@20: michael@220: # MSvB: michael@220: # MSvB: Note, see http://www.bacula.org/en/?page=news michael@220: # MSvB: for information on new configuration options. michael@223: # MSvB: Warning! -L /pfx/lib is placed before locally michael@223: # MSvB: built libraries (bacula-/src/cats...) michael@223: # MSvB: which causes the old version of bacula to michael@223: # MSvB: supply logic to the new version build! michael@220: # MSvB: michael@220: michael@20: # package information michael@20: Name: bacula michael@20: Summary: Network Backup Tool michael@20: URL: http://www.bacula.org/ michael@20: Vendor: Kern Sibbald michael@20: Packager: OpenPKG Foundation e.V. michael@20: Distribution: OpenPKG Community michael@20: Class: PLUS michael@20: Group: System michael@20: License: GPL michael@223: Version: 3.0.3 michael@223: Release: 20091028 michael@20: michael@20: # package options michael@20: %option with_server yes michael@20: %option with_ssl yes michael@20: %option with_wrap no michael@20: %option with_dvd no michael@20: %option with_mtx no michael@20: %option with_python no michael@220: %option with_dbback sqlite michael@20: michael@20: # list of sources michael@20: Source0: http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz michael@20: Source1: rc.bacula michael@20: Source2: bexec.sh michael@20: Patch0: bacula.patch michael@20: michael@20: # build information michael@20: Prefix: %{l_prefix} michael@20: BuildRoot: %{l_buildroot} michael@20: BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes michael@20: PreReq: OpenPKG, openpkg >= 20060823 michael@220: BuildPreReq: ncurses, readline, zlib, gawk michael@220: PreReq: ncurses, readline, zlib, gawk michael@20: %if "%{with_ssl}" == "yes" michael@220: BuildPreReq: openssl >= 0.9.8, openssl::with_threads = yes michael@220: PreReq: openssl >= 0.9.8, openssl::with_threads = yes michael@20: %endif michael@20: %if "%{with_wrap}" == "yes" michael@20: BuildPreReq: tcpwrappers michael@20: PreReq: tcpwrappers michael@20: %endif michael@220: %if "%{with_dbback}" == "sqlite" michael@20: BuildPreReq: sqlite michael@20: PreReq: sqlite michael@20: %endif michael@220: %if "%{with_dbback}" == "mysql" michael@20: BuildPreReq: mysql michael@20: PreReq: mysql michael@20: %endif michael@220: %if "%{with_dbback}" == "postgresql" michael@20: BuildPreReq: postgresql michael@20: PreReq: postgresql michael@20: %endif michael@20: %if "%{with_dvd}" == "yes" michael@20: BuildPreReq: dvdrw-tools michael@20: PreReq: dvdrw-tools michael@20: %endif michael@20: %if "%{with_mtx}" == "yes" michael@20: BuildPreReq: mtx michael@20: PreReq: mtx michael@20: %endif michael@20: %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes" michael@20: BuildPreReq: python michael@20: PreReq: python michael@20: %endif michael@20: AutoReq: no michael@20: AutoReqProv: no michael@20: michael@20: %description michael@20: Bacula is a set of computer programs that permit you (or the system michael@20: administrator) to manage backup, recovery, and verification of michael@20: computer data across a network of computers of different kinds. In michael@20: technical terms, it is a network client/server based backup program. michael@20: Bacula is relatively easy to use and efficient, while offering many michael@20: advanced storage management features that make it easy to find and michael@20: recover lost or damaged files. michael@20: michael@20: %track michael@20: prog bacula = { michael@20: version = %{version} michael@20: url = http://prdownloads.sourceforge.net/bacula/ michael@20: regex = bacula-(\d+\.\d*[02468]\.\d+)\.tar\.gz michael@20: } michael@20: michael@20: %prep michael@20: %setup -q michael@20: %patch -p0 michael@20: rm -f src/lib/tcpd.h michael@20: michael@20: %build michael@20: # generate a random director password michael@20: password="`openssl rand -base64 33`" michael@20: michael@20: # for the same reason remove version informations from config files michael@20: %{l_shtool} subst \ michael@20: -e "s;For Bacula release @VERSION@ .*;;" \ michael@20: `find . -name "*.conf.in"` michael@20: michael@21: # help specific platforms find fdatasync(3) michael@21: libs="" michael@21: case "%{l_platform -t}" in michael@21: *-sunos* ) libs="-lrt" ;; michael@21: esac michael@21: michael@20: # use localhost as default host michael@20: %{l_shtool} subst \ michael@20: -e 's;hostname=.*;hostname=localhost;g' \ michael@21: -e 's;\(CONS_LIBS="-lreadline.*\)-ltermcap;\1-lncurses;g' \ michael@20: configure michael@20: michael@20: # configure michael@20: LIBS= michael@20: case "%{l_platform -t}" in michael@20: *-linux*) LIBS="-L/usr/lib/termcap";; michael@20: esac michael@20: CC="%{l_cc}" \ michael@20: CFLAGS="%{l_cflags -O}" \ michael@21: CPPFLAGS="%{l_cppflags ncurses}" \ michael@20: LDFLAGS="%{l_ldflags} $LIBS" \ michael@21: LIBS="$libs" \ michael@143: GREP="grep" \ michael@20: ./configure \ michael@20: --prefix=%{l_prefix} \ michael@20: --with-dir-user=%{l_rusr} \ michael@20: --with-dir-group=%{l_rgrp} \ michael@20: --with-sd-user=%{l_rusr} \ michael@20: --with-sd-group=%{l_rgrp} \ michael@20: --with-fd-user=%{l_susr} \ michael@20: --with-fd-group=%{l_sgrp} \ michael@20: --with-dir-password="$password" \ michael@20: --with-fd-password="$password" \ michael@20: --with-sd-password="$password" \ michael@20: --with-mon-dir-password="$password" \ michael@20: --with-mon-fd-password="$password" \ michael@20: --with-mon-sd-password="$password" \ michael@20: --disable-conio \ michael@20: --enable-readline \ michael@20: --with-readline=%{l_prefix} \ michael@20: %if "%{with_server}" != "yes" michael@20: --enable-client-only \ michael@20: %endif michael@20: %if "%{with_ssl}" == "yes" michael@20: --with-openssl=%{l_prefix} \ michael@20: %endif michael@20: %if "%{with_wrap}" == "yes" michael@20: --with-tcp-wrappers=yes \ michael@20: %endif michael@220: %if "%{with_dbback}" == "sqlite" michael@20: --with-sqlite3=%{l_prefix} \ michael@20: %endif michael@220: %if "%{with_dbback}" == "mysql" michael@20: --with-mysql=%{l_prefix} \ michael@20: %endif michael@220: %if "%{with_dbback}" == "postgresql" michael@20: --with-postgresql=%{l_prefix} \ michael@20: %endif michael@20: %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes" michael@20: --with-python=%{l_prefix} \ michael@20: %endif michael@20: --enable-wx-console=no \ michael@20: --sysconfdir=%{l_prefix}/etc/bacula \ michael@21: --libexecdir=%{l_prefix}/libexec/bacula \ michael@20: --mandir=%{l_prefix}/man \ michael@20: --with-scriptdir=%{l_prefix}/libexec/bacula \ michael@20: --with-working-dir=%{l_prefix}/var/bacula \ michael@20: --with-pid-dir=%{l_prefix}/var/bacula/run \ michael@20: --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \ michael@21: --with-archivedir=/tmp \ michael@21: --with-sbin-perm=0755 \ michael@223: --disable-shared \ michael@220: --disable-libtool \ michael@20: --disable-nls michael@20: michael@20: # build michael@20: %{l_make} %{l_mflags -O} michael@20: michael@20: %install michael@20: rm -rf $RPM_BUILD_ROOT michael@20: michael@20: # create installation hierarchy michael@20: %{l_shtool} mkdir -f -p -m 755 \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/bin \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/sbin \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/var/bacula \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \ michael@20: $RPM_BUILD_ROOT%{l_prefix}/man/man1 \ michael@220: $RPM_BUILD_ROOT%{l_prefix}/man/man8 michael@20: michael@20: # install michael@20: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT michael@20: michael@20: # strip down installation michael@21: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true michael@20: ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula && michael@21: for unwanted in startmysql stopmysql; do michael@20: rm -f $unwanted michael@20: done michael@20: ) || exit $? michael@20: michael@20: # install additional files michael@20: %{l_shtool} install -c -m 754 %{l_value -s -a} \ michael@20: %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec michael@21: %{l_shtool} install -c -m 640 \ michael@21: src/console/bconsole.conf $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/ michael@20: michael@21: ## wrap binaries to avoid to specify "-c" for each run michael@21: #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin michael@21: # for bin in bacula-dir bacula-fd bacula-sd \ michael@21: # bconsole bcopy bextract bls bscan dbcheck \ michael@21: # tray-monitor wx-console; do michael@21: # if [ -x $bin ]; then michael@21: # mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula michael@21: # ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin michael@21: # fi michael@21: # done michael@21: #) || exit $? michael@20: michael@142: # install runcommand script michael@20: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@20: -e 's,@with_server@,%{with_server},g' \ michael@20: %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@20: michael@20: # determine installation files michael@20: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@20: %{l_files_std} \ michael@142: '%config(noreplace) %{l_prefix}/etc/bacula/*.conf' \ michael@142: %if "%{with_server}" == "yes" michael@142: '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \ michael@142: '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \ michael@142: '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup' \ michael@142: '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \ michael@142: %endif michael@20: '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \ michael@20: '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \ michael@142: '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \ michael@142: '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \ michael@142: '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula' michael@20: michael@20: %files -f files michael@20: michael@20: %clean michael@20: rm -rf $RPM_BUILD_ROOT michael@20: michael@20: %post michael@20: # create initial database michael@20: if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then michael@20: $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables michael@20: chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db michael@20: chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db michael@20: fi michael@20: michael@20: # after upgrade, restart service michael@20: [ $1 -eq 2 ] || exit 0 michael@20: eval `%{l_rc} bacula status 2>/dev/null` michael@20: [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart michael@20: exit 0 michael@20: michael@20: %preun michael@20: # before erase, stop service and remove working files michael@20: [ $1 -eq 0 ] || exit 0 michael@20: %{l_rc} bacula stop 2>/dev/null michael@20: rm -rf $RPM_INSTALL_PREFIX/var/bacula/* michael@20: exit 0 michael@20: