Correct the paths of patched scripts, refine password generation,

Tue, 28 Aug 2012 18:36:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:35 +0200
changeset 579
6b18bb69901e
parent 578
ac1eb2cd38a8
child 580
3648f9cc5deb

Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.

bacula/bacula.patch file | annotate | diff | comparison | revisions
bacula/bacula.spec file | annotate | diff | comparison | revisions
     1.1 --- a/bacula/bacula.patch	Tue Aug 28 18:36:30 2012 +0200
     1.2 +++ b/bacula/bacula.patch	Tue Aug 28 18:36:35 2012 +0200
     1.3 @@ -1,4 +1,5 @@
     1.4  Index: manpages/Makefile.in
     1.5 +diff -Nau manpages/Makefile.in.orig manpages/Makefile.in
     1.6  --- manpages/Makefile.in.orig	2010-08-05 16:29:51.000000000 +0200
     1.7  +++ manpages/Makefile.in	2010-12-19 19:30:06.000000000 +0100
     1.8  @@ -21,23 +21,21 @@
     1.9 @@ -32,25 +33,35 @@
    1.10   
    1.11   clean:
    1.12  Index: scripts/bacula.in
    1.13 +diff -Nau scripts/bacula.in.orig scripts/bacula.in
    1.14  --- scripts/bacula.in.orig	2010-08-05 16:29:51.000000000 +0200
    1.15  +++ scripts/bacula.in	2010-12-19 19:30:06.000000000 +0100
    1.16 -@@ -20,30 +20,36 @@
    1.17 +@@ -13,37 +13,43 @@
    1.18 + #  easier to "steal" this code for the development 
    1.19 + #  environment where they are different.
    1.20 + #  
    1.21 +-SCRIPTDIR=@scriptdir@
    1.22 ++SCRIPTDIR=@libexecdir@
    1.23 + #
    1.24 + # Disable Glibc malloc checks, it doesn't help and it keeps from getting
    1.25 + #   good dumps
    1.26   MALLOC_CHECK_=0
    1.27   export MALLOC_CHECK_
    1.28   
    1.29 +-case "$1" in
    1.30  +action=$1
    1.31  +debug=$2
    1.32  +[ -n "$3" ] && enable_dir=$3 || enable_dir=yes
    1.33  +[ -n "$4" ] && enable_sd=$4  || enable_sd=yes
    1.34  +[ -n "$5" ] && enable_fd=$5  || enable_fd=yes
    1.35 -+
    1.36 - case "$1" in
    1.37 ++ 
    1.38 ++case "$action" in
    1.39      start)
    1.40  -      [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.41  -      [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.42  -      [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
    1.43 -+      [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.44 -+      [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.45 ++      [ "$enable_sd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.46 ++      [ "$enable_fd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.47  +      [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
    1.48         ;;
    1.49   
    1.50 @@ -59,14 +70,14 @@
    1.51  -      [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.52  -      [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.53  -      [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
    1.54 -+      [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.55 -+      [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.56 ++      [ "$enable_sd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
    1.57 ++      [ "$enable_fd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
    1.58  +      [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
    1.59         ;;
    1.60   
    1.61      restart)
    1.62  -      $0 stop
    1.63 -+      $0 stop  $debug $enable_dir $enable_sd $enable_fd
    1.64 ++      $0 stop $debug $enable_dir $enable_sd $enable_fd
    1.65         sleep 2
    1.66  -      $0 start
    1.67  +      $0 start $debug $enable_dir $enable_sd $enable_fd
    1.68 @@ -76,16 +87,16 @@
    1.69  -      [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
    1.70  -      [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
    1.71  -      [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
    1.72 -+      [ "$enable_sd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
    1.73 -+      [ "$enable_fd" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
    1.74 ++      [ "$enable_sd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
    1.75 ++      [ "$enable_fd" = "yes"  ] && [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
    1.76  +      [ "$enable_dir" = "yes" ] && [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
    1.77         ;;
    1.78   
    1.79      *)
    1.80  Index: src/dird/bacula-dir.conf.in
    1.81 +diff -Nau src/dird/bacula-dir.conf.in.orig src/dird/bacula-dir.conf.in
    1.82  --- src/dird/bacula-dir.conf.in.orig	2010-08-05 16:29:51.000000000 +0200
    1.83  +++ src/dird/bacula-dir.conf.in	2010-12-19 19:30:06.000000000 +0100
    1.84 -@@ -29,7 +29,8 @@
    1.85     Level = Incremental
    1.86     Client = @basename@-fd 
    1.87     FileSet = "Full Set"
    1.88 @@ -95,6 +106,15 @@
    1.89     Storage = File
    1.90     Messages = Standard
    1.91     Pool = File
    1.92 +@@ -106,7 +107,7 @@
    1.93 + #    directory to give a reasonable FileSet to backup to
    1.94 + #    disk storage during initial testing.
    1.95 + #
    1.96 +-    File = @sbindir@
    1.97 ++    File = @scriptdir@
    1.98 +   }
    1.99 + 
   1.100 + #
   1.101  @@ -123,6 +124,11 @@
   1.102     }
   1.103   }
     2.1 --- a/bacula/bacula.spec	Tue Aug 28 18:36:30 2012 +0200
     2.2 +++ b/bacula/bacula.spec	Tue Aug 28 18:36:35 2012 +0200
     2.3 @@ -21,6 +21,15 @@
     2.4  ##  SUCH DAMAGE.
     2.5  ##
     2.6  
     2.7 +# MSvB:
     2.8 +# MSvB: Note, see http://www.bacula.org/en/?page=news
     2.9 +# MSvB: for information on new configuration options.
    2.10 +# MSvB: Warning! -L /pfx/lib is placed before locally
    2.11 +# MSvB: built libraries (bacula-<ver>/src/cats...)
    2.12 +# MSvB: which causes the old version of bacula to
    2.13 +# MSvB: supply logic to the new version build!
    2.14 +# MSvB:
    2.15 +
    2.16  #   package information
    2.17  Name:         bacula
    2.18  Summary:      Network Backup Tool
    2.19 @@ -32,7 +41,7 @@
    2.20  Group:        System
    2.21  License:      GPL
    2.22  Version:      5.2.10
    2.23 -Release:      20120629
    2.24 +Release:      20120800
    2.25  
    2.26  #   package options
    2.27  %option       with_server       yes
    2.28 @@ -60,11 +69,11 @@
    2.29  #   build information
    2.30  BuildPreReq:  OpenPKG, openpkg >= 20100101, make, gcc, gcc::with_cxx = yes
    2.31  PreReq:       OpenPKG, openpkg >= 20100101
    2.32 -BuildPreReq:  readline, zlib
    2.33 -PreReq:       readline, zlib
    2.34 +BuildPreReq:  ncurses, readline, zlib
    2.35 +PreReq:       ncurses, readline, zlib
    2.36  %if "%{with_ssl}" == "yes"
    2.37 -BuildPreReq:  openssl >= 0.9.8
    2.38 -PreReq:       openssl >= 0.9.8
    2.39 +BuildPreReq:  openssl >= 0.9.8, openssl::with_threads = yes
    2.40 +PreReq:       openssl >= 0.9.8, openssl::with_threads = yes
    2.41  %endif
    2.42  %if "%{with_wrap}" == "yes"
    2.43  BuildPreReq:  tcpwrappers
    2.44 @@ -118,13 +127,20 @@
    2.45  
    2.46  %build
    2.47      #   generate a random director password
    2.48 -    password="`openssl rand -base64 33`"
    2.49 +    #password=`tr -dc A-Za-z0-9 </dev/urandom | head -c 33`
    2.50 +    password=`%{l_openssl} rand -base64 33`
    2.51  
    2.52      #   for the same reason remove version informations from config files
    2.53      %{l_shtool} subst \
    2.54          -e "s;For Bacula release @VERSION@ .*;;" \
    2.55          `find . -name "*.conf.in"`
    2.56  
    2.57 +    #   help specific platforms find fdatasync(3)
    2.58 +    libs=""
    2.59 +    case "%{l_platform -t}" in
    2.60 +        *-sunos* ) libs="-lrt" ;;
    2.61 +    esac
    2.62 +
    2.63      #   use localhost as default host
    2.64      %{l_shtool} subst \
    2.65          -e 's;hostname=.*;hostname=localhost;g' \
    2.66 @@ -133,11 +149,11 @@
    2.67      #   configure
    2.68      LIBS=
    2.69      case "%{l_platform -t}" in
    2.70 -        *-linux*) LIBS="-L/usr/lib/termcap";;
    2.71 +        *-sunos*) LIBS="-ldl" ;;
    2.72      esac
    2.73      CC="%{l_cc}" \
    2.74      CFLAGS="%{l_cflags -O}" \
    2.75 -    CPPFLAGS="%{l_cppflags}" \
    2.76 +    CPPFLAGS="%{l_cppflags ncurses}" \
    2.77      LDFLAGS="%{l_ldflags} $LIBS" \
    2.78      ./configure \
    2.79          --prefix=%{l_prefix} \
    2.80 @@ -177,20 +193,21 @@
    2.81  %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
    2.82          --with-python=%{l_prefix} \
    2.83  %endif
    2.84 -        --enable-wx-console=no \
    2.85          --sysconfdir=%{l_prefix}/etc/bacula \
    2.86          --mandir=%{l_prefix}/man \
    2.87          --with-scriptdir=%{l_prefix}/libexec/bacula \
    2.88          --with-working-dir=%{l_prefix}/var/bacula \
    2.89          --with-pid-dir=%{l_prefix}/var/bacula/run \
    2.90          --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
    2.91 +        --with-archivedir=/tmp \
    2.92 +        --with-sbin-perm=0755 \
    2.93 +        --disable-shared \
    2.94          --disable-nls
    2.95  
    2.96      #   build
    2.97      %{l_make} %{l_mflags -O}
    2.98  
    2.99  %install
   2.100 -
   2.101      #   create installation hierarchy
   2.102      %{l_shtool} mkdir -f -p -m 755 \
   2.103          $RPM_BUILD_ROOT%{l_prefix}/bin \
   2.104 @@ -212,8 +229,7 @@
   2.105      %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   2.106  
   2.107      #   strip down installation
   2.108 -    #   do not strip binaries, to make it easier to diagnose problems
   2.109 -    #   strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   2.110 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   2.111      ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
   2.112        for unwanted in bconsole startmysql stopmysql; do
   2.113            rm -f $unwanted
   2.114 @@ -224,19 +240,19 @@
   2.115      %{l_shtool} install -c -m 754 %{l_value -s -a} \
   2.116          %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
   2.117  
   2.118 -    #   wrap binaries to avoid to specify "-c" for each run
   2.119 -    ( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
   2.120 -      for bin in bacula-dir bacula-fd bacula-sd \
   2.121 -                 bconsole bcopy bextract bls bscan dbcheck \
   2.122 -                 tray-monitor wx-console; do
   2.123 -          if [ -x $bin ]; then
   2.124 -              mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
   2.125 -              ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
   2.126 -          fi
   2.127 -      done
   2.128 -    ) || exit $?
   2.129 +    ##   wrap binaries to avoid specifying '-c' on each run
   2.130 +    #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
   2.131 +    #  for bin in bacula-dir bacula-fd bacula-sd \
   2.132 +    #             bconsole bcopy bextract bls bscan dbcheck \
   2.133 +    #             tray-monitor wx-console; do
   2.134 +    #      if [ -x $bin ]; then
   2.135 +    #          mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
   2.136 +    #          ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
   2.137 +    #      fi
   2.138 +    #  done
   2.139 +    #) || exit $?
   2.140  
   2.141 -    #   install run-command script
   2.142 +    #   install runcommand script
   2.143      %{l_shtool} install -c -m 755 %{l_value -s -a} \
   2.144          -e 's,@with_server@,%{with_server},g' \
   2.145          %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   2.146 @@ -252,15 +268,13 @@
   2.147  %if "%{with_server}" == "yes"
   2.148          '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
   2.149          '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup'\
   2.150 -        '%config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
   2.151 -        '%config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
   2.152 +        '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
   2.153 +        '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
   2.154  %endif
   2.155 -        '%config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \
   2.156 -%if "%{with_server}" == "yes"
   2.157 -        '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-dir.conf' \
   2.158 -        '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/bacula-sd.conf' \
   2.159 -%endif
   2.160 -        '%attr(640,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/bacula/bacula-fd.conf'
   2.161 +        '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-fd.conf' \
   2.162 +        '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bconsole.conf' \
   2.163 +        '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/clients' \
   2.164 +        '%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bacula/scripts'
   2.165  
   2.166  %files -f files
   2.167  
   2.168 @@ -268,11 +282,13 @@
   2.169  
   2.170  %post
   2.171      #   create initial database
   2.172 +%if "%{with_server}" == "yes"
   2.173      if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
   2.174          $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
   2.175          chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   2.176          chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
   2.177      fi
   2.178 +%endif
   2.179  
   2.180      #   after upgrade, restart service
   2.181      [ $1 -eq 2 ] || exit 0

mercurial