# TODO:
# - update desktop files, think about su-wrappers for console (with .desktop files)
-# - package web admin
# - fix log file permissions
# - check on upgrade (5.0 and 5.2 databases are NOT compatible)
#
# Conditional build:
-%bcond_without console_wx # wx-console program
-%bcond_without bat # bat Qt4 GUI
+%bcond_without wx # wx-console program
+%bcond_without gtk # the GTK tray-monitor and wx-console
+%if "%{pld_release}" == "ac"
+%bcond_with qt # BAT / qt-console Qt4 GUI
+%else
+%bcond_without qt # BAT / qt-console Qt4 GUI
+%endif
%bcond_without mysql # use MySQL
%bcond_without pgsql # use PostgreSQL
%bcond_without sqlite3 # use SQLite3
%undefine with_sqlite3_sync_off
%endif
-%define qtver 4.6.2
+%if %{without gtk}
+%undefine with_wx
+%endif
+
+%define qtver 4.8.4
Summary: Bacula - The Network Backup Solution
Summary(pl.UTF-8): Bacula - rozwiązanie do wykonywania kopii zapasowych po sieci
Name: bacula
-Version: 5.2.2
-Release: 1
+Version: 5.2.13
+Release: 4
License: AGPL v3
Group: Networking/Utilities
Source0: http://downloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
-# Source0-md5: 227b88f56ae085da8f48823b220d4c87
+# Source0-md5: 43417bae0c221afb1f30a581c9e0f2fe
Source1: http://downloads.sourceforge.net/bacula/%{name}-docs-%{version}.tar.bz2
-# Source1-md5: 478273c0229f24d6690fdbedbeb50fa4
+# Source1-md5: 0e7af41cc3b1c59662457679b02bf873
Source2: http://downloads.sourceforge.net/bacula/%{name}-rescue-5.0.1.tar.gz
# Source2-md5: bb194aed8e204f54bf2f61d7e721f257
Source10: %{name}-dir.init
Source14: %{name}-dir.sysconfig
Source15: %{name}-fd.sysconfig
Source16: %{name}-sd.sysconfig
+Source17: %{name}-dir.service
+Source18: %{name}-fd.service
+Source19: %{name}-sd.service
Patch0: %{name}-mtx-changer.patch
Patch1: %{name}-branding.patch
Patch2: %{name}-conf.patch
Patch3: %{name}-desktop.patch
Patch4: make_catalog_backup-setup-home.patch
-Patch5: %{name}-mysql_thread.patch
+Patch5: %{name}-wx-console-build.patch
+Patch6: %{name}-no_lockmgr.patch
+Patch7: wxWidgets3.patch
URL: http://www.bacula.org/
BuildRequires: acl-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext-devel
-%{?with_console_wx:BuildRequires: gtk+2-devel}
+%{?with_gtk:BuildRequires: gtk+2-devel}
BuildRequires: libcap-devel
BuildRequires: libtool >= 2:2.2
%if %{with rescue}
BuildRequires: python-devel
BuildRequires: python-modules
%endif
-%if %{with bat}
+%if %{with qt}
BuildRequires: QtCore-devel
BuildRequires: QtGui-devel
BuildRequires: qt4-build >= %{qtver}
%{?with_mysql:BuildRequires: mysql-devel}
%{?with_pgsql:BuildRequires: postgresql-devel}
BuildRequires: readline-devel
+BuildRequires: rpm >= 4.4.9-56
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rpmbuild(macros) >= 1.644
BuildRequires: sed >= 4.0
%{?with_sqlite3:BuildRequires: sqlite3-devel}
BuildRequires: which
-%if %{with console_wx}
+Requires: systemd-units >= 38
+%if %{with wx}
BuildRequires: wxGTK2-unicode-devel >= 2.4.0
%endif
BuildRequires: zlib-devel
%define _localstatedir /var/lib/%{name}
%define nagiosplugindir %{_libdir}/nagios/plugins
+# db packages contain duplicates
+%define _duplicate_files_terminate_build 0
+
# from 'the worst' to 'the best'
%define databases %{?with_sqlite3:sqlite3} %{?with_mysql:mysql} %{?with_pgsql:postgresql}
Conflicts: bacula-dir < 0:1.34.6
Conflicts: bacula-fd < 0:1.34.6
Conflicts: bacula-sd < 0:1.34.6
+Conflicts: logrotate < 3.8.0
%description common
Bacula - It comes by night and sucks the vital essence from your
użytkownikowi komunikowanie się z programem Bacula Director. To jest
interfejs graficzny oparty na wxWidgets.
-%package console-qt4
-Summary: Bacula Qt4 Console
-Summary(pl.UTF-8): Konsola Baculi oparta na Qt4
+%package console-qt
+Summary: bat – The Bacula Administration Tool
+Summary(pl.UTF-8): bat – narzędzie administratora Baculi
Group: Networking/Utilities
Requires(post): sed >= 4.0
-Requires: QtCore >= %{qtver}
Requires: %{name}-common = %{version}-%{release}
+Requires: QtCore >= %{qtver}
+Obsoletes: bacula-console-qt4 < 5.2.13-1
-%description console-qt4
+%description console-qt
Bacula - It comes by night and sucks the vital essence from your
computers.
-Bacula Console is the program that allows the administrator or user to
-communicate with the Bacula Director. This is the Qt4 GUI interface.
+bat is short for Bacula Administration Tool. It is a GUI form of
+bconsole, but with many additional features.
-%description console-qt4 -l pl.UTF-8
+%description console-qt -l pl.UTF-8
Bacula - przychodzi nocą i wysysa żywotny ekstrakt z komputerów.
-Bacula Console to program umożliwiający administratorowi lub
-użytkownikowi komunikowanie się z programem Bacula Director. To jest
-interfejs graficzny oparty na Qt4.
+bat, czyli Bacula Administration Tool, jest graficznym odpowiednikiem
+bconsole, z wieloma dodatkowymi funkcjami.
%package tray-monitor
Summary: Bacula Tray Monitor
Group: Networking/Utilities
Requires(post): sed >= 4.0
Requires: %{name}-common = %{version}-%{release}
+Suggests: mtx
Conflicts: dvd+rw-tools <= 5.21.4.10.8-1
%description sd
%description -n nagios-plugin-check_bacula
Nagios plugin to check bacula.
-# provided by various db libraries as a symlink
%define _noautoreq libbaccats-%{version}.so
+# provided by various db libraries as a symlink
%prep
%setup -q -a 1
%patch3 -p1
%patch4 -p1
%patch5 -p1
+%patch6 -p1
+%patch7 -p1
tar -xf %{SOURCE2} && ln -s bacula-rescue-* rescue
CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
WXCONFIG=%{_bindir}/wx-gtk2-unicode-config \
-QMAKE=%{_bindir}/qt4-qmake \
+QMAKE=%{_bindir}/qmake-qt4 \
%configure \
--with-scriptdir=%{_libexecdir}/%{name} \
- %{?with_bat:--enable-bat} \
+ %{?with_qt:--enable-bat} \
--disable-conio \
--enable-smartalloc \
- %{?with_console_wx:--enable-bwx-console} \
- --enable-tray-monitor \
+ %{?with_wx:--enable-bwx-console} \
+ %{?with_gtk:--enable-tray-monitor} \
%{?with_python:--with-python} \
--with-readline \
--with-tcp-wrappers \
--with-smtp-host=localhost \
--with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
- --with-systemd=/lib/systemd/system \
+ --with-systemd=%{systemdunitdir} \
--enable-batch-insert \
%{?with_pgsql:--with-postgresql} \
%{?with_mysql:--with-mysql} \
--with-mon-sd-password="#FAKE-mon-sd-password#" \
--with-openssl
-%if %{with bat}
+%if %{with qt}
cd src/qt-console
qmake-qt4 bat.pro
cd ../..
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,sysconfig}
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/rescue
-install -d $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir},%{_mandir},%{_bindir},/var/log/bacula}
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,pam.d,sysconfig} \
+ $RPM_BUILD_ROOT%{_sysconfdir}/rescue \
+ $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir}} \
+ $RPM_BUILD_ROOT{%{_mandir},%{_bindir},/var/log{,/archive}/bacula} \
+ $RPM_BUILD_ROOT%{systemdunitdir}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
cp -a %{SOURCE14} $RPM_BUILD_ROOT/etc/sysconfig/bacula-dir
cp -a %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/bacula-fd
cp -a %{SOURCE16} $RPM_BUILD_ROOT/etc/sysconfig/bacula-sd
+cp -a %{SOURCE17} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-dir.service
+cp -a %{SOURCE18} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-fd.service
+cp -a %{SOURCE19} $RPM_BUILD_ROOT%{systemdunitdir}/bacula-sd.service
-%if %{with console_wx}
-# tray-monitor is for regular users
-#mv $RPM_BUILD_ROOT%{_sbindir}/bacula-tray-monitor $RPM_BUILD_ROOT%{_bindir}
-
+%if %{with wx}
cp -a scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
-#install src/tray-monitor/generic.xpm $RPM_BUILD_ROOT%{_pixmapsdir}/bacula-tray-monitor.xpm
sed -e 's/gnome-console/wx-console/g;s/Console/Wx Console/g' \
scripts/wxconsole.desktop.consolehelper > $RPM_BUILD_ROOT%{_desktopdir}/bacula-wx.desktop
-#sed -e 's#%{_sbindir}#%{_bindir}#' \
-# scripts/bacula-tray-monitor.desktop > $RPM_BUILD_ROOT%{_desktopdir}/bacula-tray-monitor.desktop
%endif
-%if %{with bat}
+%if %{with qt}
# qmake somewhy does not always create install_bins target. install our own the bin
rm -f $RPM_BUILD_ROOT%{_sbindir}/bat
libtool --silent --mode=install install src/qt-console/bat $RPM_BUILD_ROOT%{_bindir}
+cp -a scripts/bacula.png $RPM_BUILD_ROOT%{_pixmapsdir}/bacula.png
cp -a scripts/bat.desktop $RPM_BUILD_ROOT%{_desktopdir}
%endif
# some file changes
rm -f $RPM_BUILD_ROOT%{_libexecdir}/%{name}/{gconsole,startmysql,stopmysql,bacula,bconsole,fd}
-%if %{without console_wx}
+%if %{without wx}
rm -f $RPM_BUILD_ROOT%{_desktopdir}/bacula-wx.desktop
%endif
-touch $RPM_BUILD_ROOT%{_sysconfdir}/.pw.sed
rm $RPM_BUILD_ROOT%{_docdir}/bacula/ChangeLog
rm $RPM_BUILD_ROOT%{_docdir}/bacula/INSTALL
mv $RPM_BUILD_ROOT%{_mandir}/man8/{,bacula-}dbcheck.8.gz
# no -devel files packaged, so this is also useless
-rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,py,sql}.{so,la}
+rm $RPM_BUILD_ROOT%{_libdir}/libbac{,cfg,find,py,sql,cats}.{so,la}
+#rm $RPM_BUILD_ROOT%{_libdir}/libbaccats*.{so,la}
+%{?with_mysql:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-mysql.{la,so}}
+%{?with_pgsql:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-postgresql.{la,so}}
+%{?with_sqlite3:rm $RPM_BUILD_ROOT%{_libdir}/libbaccats-sqlite3.{la,so}}
%if %{with nagios}
install -d $RPM_BUILD_ROOT%{nagiosplugindir}
You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
script to upgrade the database.
+
+Ensure you database partition has enough free space before you run the upgrade,
+i.e check that there is enough room to rebuild 'File' table (it is the largest
+in bacula db).
+
EOF
%post dir
%update_configs
/sbin/chkconfig --add bacula-dir
%service bacula-dir restart "Bacula Director daemon"
+%systemd_post bacula-dir.service
%preun dir
if [ "$1" = "0" ]; then
%service bacula-dir stop
/sbin/chkconfig --del bacula-dir
fi
+%systemd_preun bacula-dir.service
+
+%postun dir
+%systemd_reload
%post fd
%update_configs
/sbin/chkconfig --add bacula-fd
%service bacula-fd restart "Bacula File daemon"
+%systemd_post bacula-fd.service
%preun fd
if [ "$1" = "0" ]; then
%service bacula-fd stop
/sbin/chkconfig --del bacula-fd
fi
+%systemd_preun bacula-fd.service
+
+%postun fd
+%systemd_reload
%post sd
%update_configs
/sbin/chkconfig --add bacula-sd
%service bacula-sd restart "Bacula Storage daemon"
+%systemd_post bacula-sd.service
%preun sd
if [ "$1" = "0" ]; then
%service bacula-sd stop
/sbin/chkconfig --del bacula-sd
fi
+%systemd_preun bacula-sd.service
+
+%postun sd
+%systemd_reload
%pre console
if [ -e %{_sysconfdir}/console.conf -a ! -e %{_sysconfdir}/bconsole.conf ]; then
%triggerpostun common -- %{name}-common < 5.0.1-2
find %{_sysconfdir}/bat.conf* -perm /007 -print0 2>/dev/null | xargs -0 -r chmod 600 || :
-%post console-qt4
+%post console-qt
%update_configs
%post tray-monitor
%attr(770,root,bacula) %dir %{_localstatedir}
%attr(750,bacula,logs) %dir /var/log/bacula
%attr(640,bacula,logs) %ghost /var/log/bacula/log
+%attr(750,bacula,logs) %dir /var/log/archive/bacula
%files dir
%defattr(644,root,root,755)
-%doc ChangeLog CheckList ReleaseNotes kernstodo LICENSE
+%doc ChangeLog CheckList ReleaseNotes LICENSE
#%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
%attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
-%ghost %{_sysconfdir}/.pw.sed
%attr(640,root,root) %config(noreplace) /etc/logrotate.d/bacula-dir
%attr(754,root,root) /etc/rc.d/init.d/bacula-dir
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-dir
+%{systemdunitdir}/bacula-dir.service
%attr(755,root,root) %{_sbindir}/bacula-dir
%attr(755,root,root) %{_sbindir}/bregex
%attr(755,root,root) %{_sbindir}/bwild
%{_libexecdir}/%{name}/query.sql
%attr(755,root,root) %{_libexecdir}/%{name}/delete_catalog_backup
+%if %{with pgsql}
%files db-postgresql
%defattr(644,root,root,755)
%attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
%ghost %{_libexecdir}/%{name}/make_bacula_tables
%ghost %{_libexecdir}/%{name}/update_bacula_tables
%ghost %{_libexecdir}/%{name}/make_catalog_backup
+%endif
+%if %{with mysql}
%files db-mysql
%defattr(644,root,root,755)
%attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
%ghost %{_libexecdir}/%{name}/make_bacula_tables
%ghost %{_libexecdir}/%{name}/update_bacula_tables
%ghost %{_libexecdir}/%{name}/make_catalog_backup
+%endif
+%if %{with sqlite3}
%files db-sqlite3
%defattr(644,root,root,755)
%attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite3_database
%ghost %{_libexecdir}/%{name}/make_bacula_tables
%ghost %{_libexecdir}/%{name}/update_bacula_tables
%ghost %{_libexecdir}/%{name}/make_catalog_backup
+%endif
%files fd
%defattr(644,root,root,755)
%attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-fd.conf
%attr(754,root,root) /etc/rc.d/init.d/bacula-fd
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-fd
+%{systemdunitdir}/bacula-fd.service
%attr(755,root,root) %{_sbindir}/bacula-fd
%attr(755,root,root) %{_libdir}/bpipe-fd.so
%{_mandir}/man8/bacula-fd.8*
%attr(640,root,bacula) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mtx-changer.conf
%attr(754,root,root) /etc/rc.d/init.d/bacula-sd
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
+%{systemdunitdir}/bacula-sd.service
%attr(755,root,root) %{_sbindir}/bacula-sd
%attr(755,root,root) %{_sbindir}/bcopy
%attr(755,root,root) %{_sbindir}/bextract
%attr(755,root,root) %{_sbindir}/bconsole
%{_mandir}/man8/bconsole.8*
-%if %{with console_wx}
+%if %{with wx}
%files console-wx
%defattr(644,root,root,755)
%doc LICENSE
%{_mandir}/man1/bacula-bwxconsole.1*
%endif
-%if %{with bat}
-%files console-qt4
+%if %{with qt}
+%files console-qt
%defattr(644,root,root,755)
%doc LICENSE
%{_pixmapsdir}/%{name}.png
%{_docdir}/%{name}
%endif
-%if %{with console_wx}
+%if %{with gtk}
%files tray-monitor
%defattr(644,root,root,755)
%doc LICENSE