# HG changeset patch # User Michael Schloh von Bennewitz # Date 1231284341 -3600 # Node ID 8adc5213fd5572e3686815838528efbbb901253f # Parent c6c9e9bf76fda3cc9ac976a7fa9dbcd2c19b163d Import package vendor original specs for necessary manipulations. diff -r c6c9e9bf76fd -r 8adc5213fd55 bacula/bacula.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bacula/bacula.patch Wed Jan 07 00:25:41 2009 +0100 @@ -0,0 +1,131 @@ +Index: manpages/Makefile.in +--- manpages/Makefile.in.orig 2007-04-24 17:47:01 +0200 ++++ manpages/Makefile.in 2008-07-09 07:45:59 +0200 +@@ -20,23 +20,21 @@ + install: + $(MKDIR) $(DESTDIR)/$(mandir)/man8 + for I in ${MAN8}; \ +- do ($(RMF) $$I.gz; gzip -c $$I >$$I.gz; \ +- $(INSTALL_DATA) $$I.gz $(DESTDIR)$(mandir)/man8/$$I.gz; \ +- rm -f $$I.gz); \ ++ do \ ++ $(INSTALL_DATA) $$I $(DESTDIR)$(mandir)/man8/$$I; \ + done + $(MKDIR) $(DESTDIR)/$(mandir)/man1 + for I in ${MAN1}; \ +- do ($(RMF) $$I.gz; gzip -c $$I >$$I.gz; \ +- $(INSTALL_DATA) $$I.gz $(DESTDIR)$(mandir)/man1/$$I.gz; \ +- rm -f $$I.gz); \ ++ do \ ++ $(INSTALL_DATA) $$I $(DESTDIR)$(mandir)/man1/$$I; \ + done + + uninstall: + for I in ${MAN8}; \ +- do (rm -f $(DESTDIR)$(mandir)/man8/$$I.gz); \ ++ do (rm -f $(DESTDIR)$(mandir)/man8/$$I); \ + done + for I in ${MAN1}; \ +- do (rm -f $(DESTDIR)$(mandir)/man1/$$I.gz); \ ++ do (rm -f $(DESTDIR)$(mandir)/man1/$$I); \ + done + + clean: dummy +Index: scripts/bacula.in +--- scripts/bacula.in.orig 2008-07-06 15:06:15 +0200 ++++ scripts/bacula.in 2008-07-09 07:53:22 +0200 +@@ -15,30 +15,36 @@ + # + SCRIPTDIR=@scriptdir@ + ++action=$1 ++debug=$2 ++[ -n "$3" ] && enable_dir=$3 || enable_dir=yes ++[ -n "$4" ] && enable_sd=$4 || enable_sd=yes ++[ -n "$5" ] && enable_fd=$5 || enable_fd=yes ++ + case "$1" in + start) +- [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2 +- [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2 +- [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2 ++ [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2 ++ [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2 ++ [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2 + ;; + + stop) + # Stop the FD first so that SD will fail jobs and update catalog +- [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2 +- [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2 +- [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2 ++ [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2 ++ [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2 ++ [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2 + ;; + + restart) +- $0 stop ++ $0 stop $debug $enable_dir $enable_sd $enable_fd + sleep 2 +- $0 start ++ $0 start $debug $enable_dir $enable_sd $enable_fd + ;; + + status) +- [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status +- [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status +- [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status ++ [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status ++ [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status ++ [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status + ;; + + *) +Index: scripts/btraceback.in +--- scripts/btraceback.in.orig 2008-06-01 10:49:00 +0200 ++++ scripts/btraceback.in 2008-07-09 07:45:59 +0200 +@@ -12,6 +12,9 @@ + PNAME="${PNAME} on `hostname`" + if test `uname -s` = SunOS ; then + gcore -o @working_dir@/${PNAME} $2 ++fi ++if test `uname -s` = SunOS && ++ test -n `which dbx 2>/dev/null` ; then + dbx $1 $2 <@scriptdir@/btraceback.dbx 2>&1 \ + | @sbindir@/bsmtp -h @smtp_host@ -f @dump_email@ -s "Bacula DBX traceback of ${PNAME}" @dump_email@ + else +Index: src/dird/bacula-dir.conf.in +--- src/dird/bacula-dir.conf.in.orig 2008-06-19 21:44:34 +0200 ++++ src/dird/bacula-dir.conf.in 2008-07-09 07:45:59 +0200 +@@ -29,7 +29,8 @@ + Level = Incremental + Client = @hostname@-fd + FileSet = "Full Set" +- Schedule = "WeeklyCycle" ++ #Schedule = "WeeklyCycle" ++ Schedule = "NEVER" + Storage = File + Messages = Standard + Pool = Default +@@ -109,7 +110,7 @@ + # directory to give a reasonable FileSet to backup to + # disk storage during initial testing. + # +- File = @BUILD_DIR@ ++ File = @scriptdir@ + } + + # +@@ -124,6 +125,11 @@ + } + } + ++# This schedule can be used to disable automatic scheduling ++Schedule { ++ Name = NEVER ++} ++ + # + # When to do the backups, full backup on first sunday of the month, + # differential (i.e. incremental since full) every other sunday, diff -r c6c9e9bf76fd -r 8adc5213fd55 bacula/bacula.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bacula/bacula.spec Wed Jan 07 00:25:41 2009 +0100 @@ -0,0 +1,296 @@ +## +## bacula.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package information +Name: bacula +Summary: Network Backup Tool +URL: http://www.bacula.org/ +Vendor: Kern Sibbald +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: PLUS +Group: System +License: GPL +Version: 2.4.3 +Release: 20081013 + +# package options +%option with_server yes +%option with_ssl yes +%option with_wrap no +%option with_dvd no +%option with_mtx no +%option with_python no +%option with_db_sqlite no +%option with_db_pgsql no +%option with_db_mysql no + +# package option sanity check +%if "%{with_db_sqlite}" == "no" && "%{with_db_mysql}" == "no" && "%{with_db_pgsql}" == "no" +%undefine with_db_sqlite +%define with_db_sqlite yes +%endif + +# list of sources +Source0: http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz +Source1: rc.bacula +Source2: bexec.sh +Patch0: bacula.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes +PreReq: OpenPKG, openpkg >= 20060823 +BuildPreReq: readline, zlib +PreReq: readline, zlib +%if "%{with_ssl}" == "yes" +BuildPreReq: openssl >= 0.9.8 +PreReq: openssl >= 0.9.8 +%endif +%if "%{with_wrap}" == "yes" +BuildPreReq: tcpwrappers +PreReq: tcpwrappers +%endif +%if "%{with_db_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif +%if "%{with_db_mysql}" == "yes" +BuildPreReq: mysql +PreReq: mysql +%endif +%if "%{with_db_pgsql}" == "yes" +BuildPreReq: postgresql +PreReq: postgresql +%endif +%if "%{with_dvd}" == "yes" +BuildPreReq: dvdrw-tools +PreReq: dvdrw-tools +%endif +%if "%{with_mtx}" == "yes" +BuildPreReq: mtx +PreReq: mtx +%endif +%if "%{with_python}" == "yes" || "%{with_dvd}" == "yes" +BuildPreReq: python +PreReq: python +%endif +AutoReq: no +AutoReqProv: no + +%description + Bacula is a set of computer programs that permit you (or the system + administrator) to manage backup, recovery, and verification of + computer data across a network of computers of different kinds. In + technical terms, it is a network client/server based backup program. + Bacula is relatively easy to use and efficient, while offering many + advanced storage management features that make it easy to find and + recover lost or damaged files. + +%track + prog bacula = { + version = %{version} + url = http://prdownloads.sourceforge.net/bacula/ + regex = bacula-(\d+\.\d*[02468]\.\d+)\.tar\.gz + } + +%prep + %setup -q + %patch -p0 + rm -f src/lib/tcpd.h + +%build + # generate a random director password + password="`openssl rand -base64 33`" + + # for the same reason remove version informations from config files + %{l_shtool} subst \ + -e "s;For Bacula release @VERSION@ .*;;" \ + `find . -name "*.conf.in"` + + # use localhost as default host + %{l_shtool} subst \ + -e 's;hostname=.*;hostname=localhost;g' \ + configure + + # configure + LIBS= + case "%{l_platform -t}" in + *-linux*) LIBS="-L/usr/lib/termcap";; + esac + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags} $LIBS" \ + ./configure \ + --prefix=%{l_prefix} \ + --with-dir-user=%{l_rusr} \ + --with-dir-group=%{l_rgrp} \ + --with-sd-user=%{l_rusr} \ + --with-sd-group=%{l_rgrp} \ + --with-fd-user=%{l_susr} \ + --with-fd-group=%{l_sgrp} \ + --with-dir-password="$password" \ + --with-fd-password="$password" \ + --with-sd-password="$password" \ + --with-mon-dir-password="$password" \ + --with-mon-fd-password="$password" \ + --with-mon-sd-password="$password" \ + --disable-conio \ + --enable-readline \ + --with-readline=%{l_prefix} \ +%if "%{with_server}" != "yes" + --enable-client-only \ +%endif +%if "%{with_ssl}" == "yes" + --with-openssl=%{l_prefix} \ +%endif +%if "%{with_wrap}" == "yes" + --with-tcp-wrappers=yes \ +%endif +%if "%{with_db_sqlite}" == "yes" + --with-sqlite3=%{l_prefix} \ +%endif +%if "%{with_db_mysql}" == "yes" + --with-mysql=%{l_prefix} \ +%endif +%if "%{with_db_pgsql}" == "yes" + --with-postgresql=%{l_prefix} \ +%endif +%if "%{with_python}" == "yes" || "%{with_dvd}" == "yes" + --with-python=%{l_prefix} \ +%endif + --enable-wx-console=no \ + --sysconfdir=%{l_prefix}/etc/bacula \ + --mandir=%{l_prefix}/man \ + --with-scriptdir=%{l_prefix}/libexec/bacula \ + --with-working-dir=%{l_prefix}/var/bacula \ + --with-pid-dir=%{l_prefix}/var/bacula/run \ + --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \ + --disable-nls + + # build + %{l_make} %{l_mflags -O} + +%install + rm -rf $RPM_BUILD_ROOT + + # create installation hierarchy + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/bin \ + $RPM_BUILD_ROOT%{l_prefix}/sbin \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \ + $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \ + $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \ + $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/var/bacula \ + $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \ + $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \ + $RPM_BUILD_ROOT%{l_prefix}/man/man1 \ + $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ + $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples \ + $RPM_BUILD_ROOT%{l_prefix}/share/bacula/examples/default-config + + # install + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # strip down installation + # do not strip binaries, to make it easier to diagnose problems + # strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true + ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula && + for unwanted in bconsole startmysql stopmysql; do + rm -f $unwanted + done + ) || exit $? + + # install additional files + %{l_shtool} install -c -m 754 %{l_value -s -a} \ + %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec + + # wrap binaries to avoid to specify "-c" for each run + ( cd $RPM_BUILD_ROOT%{l_prefix}/sbin + for bin in bacula-dir bacula-fd bacula-sd \ + bconsole bcopy bextract bls bscan dbcheck \ + tray-monitor wx-console; do + if [ -x $bin ]; then + mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula + ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin + fi + done + ) || exit $? + + # install run-command script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + -e 's,@with_server@,%{with_server},g' \ + %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%attr(640,%{l_musr},%{l_mgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bconsole.conf' \ + '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula' \ + '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \ + '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \ + '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \ + '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \ +%if "%{with_server}" == "yes" + '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \ + '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\ + '%config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \ + '%config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \ +%endif + '%config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \ +%if "%{with_server}" == "yes" + '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-dir.conf' \ + '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-sd.conf' \ +%endif + '%attr(640,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/bacula/bacula-fd.conf' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # create initial database + if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then + $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables + chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db + chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db + fi + + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} bacula status 2>/dev/null` + [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart + exit 0 + +%preun + # before erase, stop service and remove working files + [ $1 -eq 0 ] || exit 0 + %{l_rc} bacula stop 2>/dev/null + rm -rf $RPM_INSTALL_PREFIX/var/bacula/* + exit 0 + diff -r c6c9e9bf76fd -r 8adc5213fd55 bacula/bexec.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bacula/bexec.sh Wed Jan 07 00:25:41 2009 +0100 @@ -0,0 +1,21 @@ +#!/bin/sh +myName=`basename $0` +cfgPath="@l_prefix@/etc/bacula" +case "$myName" in + bacula-dir ) cfg="bacula-dir.conf" ;; + bacula-fd ) cfg="bacula-fd.conf" ;; + bacula-sd ) cfg="bacula-sd.conf" ;; + bconsole ) cfg="bconsole.conf" ;; + bcopy ) cfg="bacula-sd.conf" ;; + bextract ) cfg="bacula-sd.conf" ;; + bls ) cfg="bacula-sd.conf" ;; + bscan ) cfg="bacula-sd.conf" ;; + dbcheck ) cfg="bacula-dir.conf" ;; + tray-monitor ) cfg="tray-monitor.conf" ;; + wx-console ) cfg="wx-console.conf" ;; + * ) echo "bexec: illegal link to '$0'" 1>&2; exit 1 ;; +esac +cfg="$cfgPath/$cfg" +# The user is still able to specify own config files, because +# the commands accept multiple '-c' options. The last '-c' wins. +exec @l_prefix@/libexec/bacula/$myName -c $cfg "$@" diff -r c6c9e9bf76fd -r 8adc5213fd55 bacula/rc.bacula --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bacula/rc.bacula Wed Jan 07 00:25:41 2009 +0100 @@ -0,0 +1,54 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.bacula -- Run-Commands +## + +%config + bacula_enable="$openpkg_rc_def" + bacula_dir_enable="@with_server@" + bacula_sd_enable="@with_server@" + bacula_fd_enable="yes" + bacula_debug="" + bacula_log_files="@l_prefix@/var/bacula/log" + bacula_log_prolog="true" + bacula_log_epilog="true" + bacula_log_numfiles="10" + bacula_log_minsize="1M" + bacula_log_complevel="9" + +%status -u @l_susr@ -o + bacula_usable="no" + bacula_active="no" + [ ".`@l_prefix@/libexec/bacula/bacula status 2>/dev/null | grep running`" != . ] && bacula_active="yes" + echo "bacula_enable=\"$bacula_enable\"" + echo "bacula_usable=\"$bacula_usable\"" + echo "bacula_active=\"$bacula_active\"" + +%start -u @l_susr@ + rcService bacula enable yes || exit 0 + rcService bacula active yes && exit 0 + @l_prefix@/libexec/bacula/bacula start \ + "$bacula_debug" $bacula_dir_enable $bacula_sd_enable $bacula_fd_enable + +%stop -u @l_susr@ + rcService bacula enable yes || exit 0 + rcService bacula active no && exit 0 + @l_prefix@/libexec/bacula/bacula stop + +%restart -u @l_susr@ + rcService bacula enable yes || exit 0 + rc bacula stop + sleep 5 + rc bacula start + +%daily -u @l_susr@ + rcService bacula enable yes || exit 0 + if [ ".$bacula_log_files" != . ]; then + shtool rotate -f \ + -n ${bacula_log_numfiles} -s ${bacula_log_minsize} -d \ + -z ${bacula_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 640 \ + -P "${bacula_log_prolog}" \ + -E "${bacula_log_epilog}" \ + $bacula_log_files + fi +