]> git.pld-linux.org Git - packages/bacula.git/blobdiff - bacula.spec
- release 3
[packages/bacula.git] / bacula.spec
index df0c02bc51e58351934bba6e1a41878db61f171b..1057f95d815b7340f89bf0c926d4dbbb71aa08f3 100644 (file)
@@ -4,27 +4,55 @@
 #      - fix log file permissions
 #
 # Conditional build:
-%bcond_without console_wx      # wx-console program
-%bcond_without gnome           # gnome-console program
+%bcond_without console_wx              # wx-console program
+%bcond_without gnome                   # gnome-console program
+%bcond_with    sqlite                  # use SQLite
+%bcond_without bat                     # bat Qt4 GUI
+%bcond_without mysql                   # use MySQL
+%bcond_with    pgsql                   # use PostgreSQL
 %bcond_with    python
 %bcond_with    rescue
-%bcond_with    sqlite3         # use sqlite3 insted sqlite
-%bcond_with    sqlite3_sync_off        # makes sqlite3 backend much faster, but less reliable
+%bcond_with    sqlite3                 # use SQLite3 instead of SQLite 2
+%bcond_with    sqlite3_sync_off        # makes SQLite3 backend much faster, but less reliable
+%if %{with sqlite}
+%define                database        sqlite
+%undefine       with_mysql
+%undefine       with_pgsql
+%endif
+%if %{with sqlite3}
+%define                database        sqlite3
+%undefine       with_sqlite
+%undefine       with_mysql
+%undefine       with_pgsql
+%endif
+%if %{with pgsql}
+%define                database        postgresql
+%undefine       with_sqlite
+%undefine       with_sqlite3
+%undefine       with_mysql
+%endif
+%if %{with mysql}
+%define                database        mysql
+%undefine       with_sqlite
+%undefine       with_sqlite3
+%undefine       with_pgsql
+%undefine       with_sqlite3_sync_off
+%endif
 #
 Summary:       Bacula - The Network Backup Solution
 Summary(pl.UTF-8):     Bacula - rozwiązanie do wykonywania kopii zapasowych po sieci
 Name:          bacula
-Version:       2.0.3
-Release:       0.1
+Version:       2.4.4
+Release:       3
 Epoch:         0
 License:       extended GPL v2
 Group:         Networking/Utilities
 Source0:       http://dl.sourceforge.net/bacula/%{name}-%{version}.tar.gz
-# Source0-md5: 443d2560ace95173a0d8ba465de493ef
-Source1:       http://dl.sourceforge.net/bacula/%{name}-docs-%{version}.tar.gz
-# Source1-md5: dce3aed621b9e4abee51cc89aebf4a58
-Source2:       http://dl.sourceforge.net/bacula/%{name}-rescue-2.0.0.tar.gz
-# Source2-md5: 4a21381f16355193771a34fc2eb4e806
+# Source0-md5: 4eb6155b45611018af03002d37a2ffde
+Source1:       http://dl.sourceforge.net/bacula/%{name}-docs-%{version}.tar.bz2
+# Source1-md5: d9bb3e8ca8c9a4c741b83569c21a4806
+Source2:       http://dl.sourceforge.net/bacula/%{name}-rescue-%{version}.tar.gz
+# Source2-md5: 320f95575591d285c3192e58912322c4
 Source10:      %{name}-dir.init
 Source11:      %{name}-fd.init
 Source12:      %{name}-sd.init
@@ -34,9 +62,11 @@ Source15:    %{name}-fd.sysconfig
 Source16:      %{name}-sd.sysconfig
 Patch0:                %{name}-dvd-handler_path.patch
 Patch1:                %{name}-link.patch
-Patch2:                %{name}-compile.patch
-Patch3:                %{name}-wx28.patch
-Patch4:                %{name}-sqlite3_init_query.patch
+Patch2:                %{name}-mysql.patch
+Patch3:                %{name}-tinfo-readline.patch
+Patch4:                %{name}-branding.patch
+Patch5:                %{name}-conf.patch
+Patch6:                %{name}-nostatic.patch
 URL:           http://www.bacula.org/
 BuildRequires: acl-static
 BuildRequires: automake
@@ -58,14 +88,20 @@ BuildRequires:      pkgconfig
 %if %{with python}
 BuildRequires: python-static
 %endif
+%if %{with bat}
+BuildRequires: QtCore-devel
+BuildRequires: QtGui-devel
+BuildRequires: qt4-build >= 4.3.3-3
+BuildRequires: qt4-qmake >= 4.3.3-3
+BuildRequires: qwt-devel >= 5.0.2-2
+%endif
+%{?with_mysql:BuildRequires:   mysql-devel}
+%{?with_pgsql:BuildRequires:   postgresql-devel}
 BuildRequires: readline-devel
 BuildRequires: rpmbuild(macros) >= 1.268
 BuildRequires: sed >= 4.0
-%if %{with sqlite3}
-BuildRequires: sqlite3-devel
-%else
-BuildRequires: sqlite-devel
-%endif
+%{?with_sqlite:BuildRequires:  sqlite-devel}
+%{?with_sqlite3:BuildRequires: sqlite3-devel}
 %if %{with console_wx}
 BuildRequires: wxGTK2-unicode-devel >= 2.4.0
 %endif
@@ -163,7 +199,7 @@ maintaining the file indexes and volume databases for all files backed
 up. The Catalog services permit the System Administrator or user to
 quickly locate and restore any desired file, since it maintains a
 record of all Volumes used, all Jobs run, and all Files saved. This
-build requires sqlite%{?with_sqlite3:3} to be installed separately as the catalog
+build requires %{database} to be installed separately as the catalog
 database.
 
 %description dir -l pl.UTF-8
@@ -178,8 +214,8 @@ i bazą danych wolumenów dla wszystkich kopiowanych plików. Usługi
 katalogowe umożliwiają administratorowi lub użytkownikowi szybko
 zlokalizować i odtworzyć dowolny plik, ponieważ utrzymują rekord ze
 wszystkimi używanymi wolumenami, uruchomionymi zadaniami i zapisanymi
-plikami. Pakiet wymaga sqlite%{?with_sqlite3:3} zainstalowanego oddzielnie jako bazy
-danych dla katalogu.
+plikami. Pakiet wymaga %{database} zainstalowanego oddzielnie jako
+bazy danych dla katalogu.
 
 %package console
 Summary:       Bacula Console
@@ -246,6 +282,27 @@ Bacula Console to program umożliwiający administratorowi lub
 użytkownikowi komunikowanie się z programem Bacula Director. To jest
 interfejs graficzny oparty na GNOME.
 
+%package console-qt4
+Summary:       Bacula Qt4 Console
+Summary(pl.UTF-8):     Konsola Baculi oparta na Qt4
+Group:         Networking/Utilities
+Requires(post):        sed >= 4.0
+Requires:      %{name}-common = %{epoch}:%{version}-%{release}
+
+%description console-qt4
+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.
+
+%description console-qt4 -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.
+
 %package tray-monitor
 Summary:       Bacula Tray Monitor
 Group:         Networking/Utilities
@@ -378,15 +435,17 @@ danego systemu, należy ponownie uruchomić ./getdiskinfo .
 
 %prep
 %setup -q -a 1
+
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 tar -xf %{SOURCE2} && ln -s bacula-rescue-* rescue
-sed -i -e 's#wx-config#wx-gtk2-unicode-config#g' configure*
-sed -i -e 's#-lreadline -lhistory -ltermcap#-lreadline -lhistory#g' configure*
+
 sed -i -e 's#bindir=.*#bindir=%{_bindir}#g' \
        src/cats/create_* src/cats/delete_* src/cats/drop_* \
        src/cats/grant_* src/cats/make_* src/cats/update_*
@@ -394,13 +453,18 @@ sed -i -e 's/@hostname@/--hostname--/' src/*/*.conf.in
 
 %build
 cp -f %{_datadir}/automake/config.sub autoconf
+cd autoconf && %{__aclocal} -I bacula-macros -I gettext-macros && cd ..
+%{__autoconf} --prepend-include=$(pwd)/autoconf autoconf/configure.in > configure
+
 CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
+WXCONFIG=%{_bindir}/wx-gtk2-unicode-config \
 %configure \
        --with-scriptdir=%{_libexecdir}/%{name} \
        --%{!?with_gnome:dis}%{?with_gnome:en}able-gnome \
+       %{?with_bat:--enable-bat} \
        --disable-conio \
        --enable-smartalloc \
-       %{?with_console_wx:--enable-wx-console} \
+       %{?with_console_wx:--enable-bwx-console} \
        --enable-tray-monitor \
        %{?with_python:--with-python} \
        --with-readline \
@@ -411,7 +475,8 @@ CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
        --with-smtp-host=localhost \
        --with-pid-dir=/var/run \
        --with-subsys-dir=/var/lock/subsys \
-       --with-sqlite%{?with_sqlite3:3} \
+       --enable-batch-insert \
+       --with-%{database} \
        %{?with_sqlite3_sync_off:--enable-extra-sqlite3-init="pragma synchronous=0;"} \
        --with-dir-password="#FAKE-dir-password#" \
        --with-fd-password="#FAKE-fd-password#" \
@@ -419,8 +484,14 @@ CPPFLAGS="-I/usr/include/ncurses -I%{_includedir}/readline"
        --with-mon-dir-password="#FAKE-mon-dir-password#" \
        --with-mon-fd-password="#FAKE-mon-fd-password#" \
        --with-mon-sd-password="#FAKE-mon-sd-password#" \
-       --enable-static-fd \
        --with-openssl
+
+%if %{with bat}
+cd src/qt-console
+qmake-qt4 bat.pro
+cd ../..
+%endif
+
 %{__make}
 
 %if %{with rescue}
@@ -436,14 +507,14 @@ 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}}
+install -d $RPM_BUILD_ROOT{%{_pixmapsdir},%{_desktopdir},%{_mandir},%{_bindir},/var/log/bacula}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
 # static daemon
-strip -R.comment -R.note src/filed/static-bacula-fd
-install src/filed/static-bacula-fd $RPM_BUILD_ROOT%{_sysconfdir}/rescue/bacula-fd
+#strip -R.comment -R.note src/filed/static-bacula-fd
+#install src/filed/static-bacula-fd $RPM_BUILD_ROOT%{_sysconfdir}/rescue/bacula-fd
 
 install %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-dir
 install %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/bacula-fd
@@ -466,6 +537,11 @@ sed -e 's#%{_sbindir}#%{_bindir}#' \
        scripts/bacula-tray-monitor.desktop > $RPM_BUILD_ROOT%{_desktopdir}/bacula-tray-monitor.desktop
 %endif
 
+%if %{with bat}
+install src/qt-console/bat $RPM_BUILD_ROOT%{_sbindir}
+install scripts/bat.desktop $RPM_BUILD_ROOT%{_desktopdir}
+%endif
+
 %if %{with rescue}
 # install the rescue stuff, these are the rescue scripts
 install rescue/linux/floppy/backup.etc.list $RPM_BUILD_ROOT%{_sysconfdir}/rescue
@@ -474,6 +550,8 @@ install rescue/linux/floppy/getdiskinfo $RPM_BUILD_ROOT%{_sysconfdir}/rescue
 install rescue/linux/floppy/sfdisk.bz2 $RPM_BUILD_ROOT%{_sysconfdir}/rescue
 %endif
 
+touch $RPM_BUILD_ROOT/var/log/bacula/log
+
 # install the updatedb scripts
 install updatedb/update_sqlite* $RPM_BUILD_ROOT%{_libexecdir}/%{name}
 
@@ -520,46 +598,43 @@ fi
 
 %post dir
 umask 077
+
+# XXX: Most of this upgrade procedure is safe for sqlite only. Other databases would require knowledge
+#      about currently used version so we can't easily support these :(
+
+%if %{with sqlite} || %{with sqlite3}
 [ -s %{_localstatedir}/bacula.db ] && \
        DB_VER=`echo "select * from Version;" | \
        %{_bindir}/sqlite%{?with_sqlite3:3} %{_localstatedir}/bacula.db | tail -n 1 2>/dev/null`
+
 if [ -z "$DB_VER" ]; then
 # grant privileges and create tables
        %{_libexecdir}/%{name}/grant_bacula_privileges > dev/null
        %{_libexecdir}/%{name}/create_bacula_database > dev/null
        %{_libexecdir}/%{name}/make_bacula_tables > dev/null
-elif [ "$DB_VER" -lt "9" ]; then
+else
        echo "Backing up bacula tables"
        echo ".dump" | sqlite%{?with_sqlite3:3} %{_localstatedir}/bacula.db | bzip2 > %{_localstatedir}/bacula_backup.sql.bz2
-       echo "Upgrading bacula tables"
-       %if %{with sqlite3}
-               type=sqlite3
-               if [ "$DB_VER" -lt "9" ]; then
-                       %{_libexecdir}/%{name}/update_${type}_tables_8_to_9
-               fi
-       %else
-               type=sqlite
-               if [ "$DB_VER" -lt "9" ]; then
-                       if [ "$DB_VER" -lt "8" ]; then
-                               if [ "$DB_VER" -lt "7" ]; then
-                                       if [ "$DB_VER" -lt "6" ]; then
-                                               if [ "$DB_VER" -lt "5" ]; then
-                                                       %{_libexecdir}/%{name}/update_${type}_tables_4_to_5
-                                               fi
-                                               %{_libexecdir}/%{name}/update_${type}_tables_5_to_6
-                                       fi
-                                       %{_libexecdir}/%{name}/update_${type}_tables_6_to_7
-                               fi
-                               %{_libexecdir}/%{name}/update_${type}_tables_7_to_8
-                       fi
-                       %{_libexecdir}/%{name}/update_${type}_tables_8_to_9
+
+       db_type="%{database}"
+
+       next_ver=$(($DB_VER + 1))
+       # support up to version 30; increase this if needed
+       for ver in $(seq $next_ver 30); do
+               prev_ver=$(($ver - 1))
+
+               if [ -x %{_libexecdir}/%{name}/update_${type}_tables_${prev_ver}_to_${ver} ]; then
+                       echo "Upgrading bacula database: db=${db_type} from ${prev_ver} to ${ver}..."
+                       %{_libexecdir}/%{name}/update_${type}_tables_${prev_ver}_to_${ver}
                fi
-       %endif
+       done
+
        %{_libexecdir}/%{name}/update_bacula_tables
        echo "If bacula works correctly you can remove the backup file %{_localstatedir}/bacula_backup.sql.bz2"
 fi
 chown -R bacula:bacula %{_localstatedir}
 chmod -R u+rX,go-rwx %{_localstatedir}/*
+%endif
 
 echo "Updating Bacula passwords and names..."
 cd /etc/bacula
@@ -646,6 +721,15 @@ for f in *-password ; do
 done
 sed -i -e"s:--hostname--:`hostname`:" *.conf *.conf.rpmnew 2>/dev/null || :
 
+%post console-qt4
+echo "Updating Bacula passwords and names..."
+cd /etc/bacula
+for f in *-password ; do
+       p=`cat $f`
+       sed -i -e"s:#FAKE-$f#:$p:" *.conf *.conf.rpmnew 2>/dev/null || :
+done
+sed -i -e"s:--hostname--:`hostname`:" *.conf *.conf.rpmnew 2>/dev/null || :
+
 %post tray-monitor
 echo "Updating Bacula passwords and names..."
 cd /etc/bacula
@@ -690,12 +774,14 @@ fi
 %{_libexecdir}/%{name}/btraceback.dbx
 %{_libexecdir}/%{name}/btraceback.gdb
 %attr(770,root,bacula) %dir %{_localstatedir}
+%attr(750,bacula,logs) %dir /var/log/bacula
+%attr(640,bacula,logs) %ghost /var/log/bacula/log
 
 %files dir
 %defattr(644,root,root,755)
 %doc ChangeLog CheckList ReleaseNotes kernstodo LICENSE
 #%doc examples %{name}-docs-%{version}/manual/{*.pdf,bacula}
-%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-dir.conf
+%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
@@ -714,7 +800,8 @@ fi
 %attr(755,root,root) %{_libexecdir}/%{name}/grant_sqlite3_privileges
 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite3_tables
 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite3_*
-%else
+%endif
+%if %{with sqlite}
 %attr(755,root,root) %{_libexecdir}/%{name}/create_sqlite_database
 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite_database
 %attr(755,root,root) %{_libexecdir}/%{name}/drop_sqlite_tables
@@ -722,6 +809,22 @@ fi
 %attr(755,root,root) %{_libexecdir}/%{name}/make_sqlite_tables
 %attr(755,root,root) %{_libexecdir}/%{name}/update_sqlite_*
 %endif
+%if %{with mysql}
+%attr(755,root,root) %{_libexecdir}/%{name}/create_mysql_database
+%attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_database
+%attr(755,root,root) %{_libexecdir}/%{name}/drop_mysql_tables
+%attr(755,root,root) %{_libexecdir}/%{name}/grant_mysql_privileges
+%attr(755,root,root) %{_libexecdir}/%{name}/make_mysql_tables
+%attr(755,root,root) %{_libexecdir}/%{name}/update_mysql_*
+%endif
+%if %{with pgsql}
+%attr(755,root,root) %{_libexecdir}/%{name}/create_postgresql_database
+%attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_database
+%attr(755,root,root) %{_libexecdir}/%{name}/drop_postgresql_tables
+%attr(755,root,root) %{_libexecdir}/%{name}/grant_postgresql_privileges
+%attr(755,root,root) %{_libexecdir}/%{name}/make_postgresql_tables
+%attr(755,root,root) %{_libexecdir}/%{name}/update_postgresql_*
+%endif
 %attr(755,root,root) %{_libexecdir}/%{name}/create_bacula_database
 %attr(755,root,root) %{_libexecdir}/%{name}/drop_bacula_database
 %attr(755,root,root) %{_libexecdir}/%{name}/drop_bacula_tables
@@ -743,7 +846,6 @@ fi
 %files sd
 %defattr(644,root,root,755)
 %doc LICENSE
-%dir %{_sysconfdir}
 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bacula-sd.conf
 %attr(754,root,root) /etc/rc.d/init.d/bacula-sd
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/bacula-sd
@@ -776,9 +878,9 @@ fi
 %doc LICENSE
 %{_pixmapsdir}/%{name}.png
 %{_desktopdir}/bacula-wx.desktop
-%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/wx-console.conf
-%attr(755,root,root) %{_sbindir}/wx-console
-%{_mandir}/man1/bacula-wxconsole.1*
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bwx-console.conf
+%attr(755,root,root) %{_sbindir}/bwx-console
+%{_mandir}/man1/bacula-bwxconsole.1*
 %endif
 
 %if %{with gnome}
@@ -787,9 +889,20 @@ fi
 %doc LICENSE
 %{_pixmapsdir}/%{name}.png
 %{_desktopdir}/bacula.desktop
-%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gnome-console.conf
-%attr(755,root,root) %{_sbindir}/gnome-console
-%{_mandir}/man1/bacula-console-gnome.1*
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bgnome-console.conf
+%attr(755,root,root) %{_sbindir}/bgnome-console
+%{_mandir}/man1/bacula-bgnome-console.1*
+%endif
+
+%if %{with bat}
+%files console-qt4
+%defattr(644,root,root,755)
+%doc LICENSE
+%{_pixmapsdir}/%{name}.png
+%{_desktopdir}/bat.desktop
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/bat.conf
+%attr(755,root,root) %{_sbindir}/bat
+%{_mandir}/man1/bat.1*
 %endif
 
 %if %{with console_wx}
This page took 0.05084 seconds and 4 git commands to generate.