diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..e8415de --- /dev/null +++ b/_constraints @@ -0,0 +1,6 @@ + + + 4.0 + + + diff --git a/bacula-9.4.4.tar.gz b/bacula-9.4.4.tar.gz new file mode 100644 index 0000000..8075abe Binary files /dev/null and b/bacula-9.4.4.tar.gz differ diff --git a/bacula-autoconf.patch b/bacula-autoconf.patch new file mode 100644 index 0000000..0cfe4c8 --- /dev/null +++ b/bacula-autoconf.patch @@ -0,0 +1,35 @@ +diff -Naur bacula-7.0.4.old/autoconf/ltmain.sh bacula-7.0.4/autoconf/ltmain.sh +--- bacula-7.0.4.old/autoconf/ltmain.sh 2014-07-24 17:43:23.085243360 +0200 ++++ bacula-7.0.4/autoconf/ltmain.sh 2014-07-24 17:45:12.505330842 +0200 +@@ -2429,6 +2429,7 @@ + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension ++ -soname SONAME override the standard shared object name + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries +@@ -5434,6 +5435,11 @@ + prev= + continue + ;; ++ soname) ++ soname_spec="$arg" ++ prev= ++ continue ++ ;; + weak) + func_append weak_libs " $arg" + prev= +@@ -5754,6 +5760,11 @@ + continue + ;; + ++ -soname) ++ prev=soname ++ continue ++ ;; ++ + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that diff --git a/bacula-dir.service b/bacula-dir.service new file mode 100644 index 0000000..a2e316b --- /dev/null +++ b/bacula-dir.service @@ -0,0 +1,12 @@ +[Unit] +Description=Bacula Director +Documentation=man:bacula-dir(8) +After=network.target nss-lookup.target + +[Service] +Environment=CONFIG=/etc/bacula/bacula-dir.conf +EnvironmentFile=-/etc/sysconfig/bacula-dir +ExecStart=/usr/sbin/bacula-dir -f $OPTS -c $CONFIG -u bacula -g bacula + +[Install] +WantedBy=multi-user.target diff --git a/bacula-dir.sysconfig b/bacula-dir.sysconfig new file mode 100644 index 0000000..3ff63c4 --- /dev/null +++ b/bacula-dir.sysconfig @@ -0,0 +1,5 @@ +# Add extra options to the bacula-dir daemon here + +# Useful for debugging +# +# OPTS="-d 200" diff --git a/bacula-fd.service b/bacula-fd.service new file mode 100644 index 0000000..6ddc257 --- /dev/null +++ b/bacula-fd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Bacula FileDaemon +Documentation=man:bacula-fd(8) +After=network.target nss-lookup.target + +[Service] +Environment=CONFIG=/etc/bacula/bacula-fd.conf +EnvironmentFile=-/etc/sysconfig/bacula-fd +ExecStart=/usr/sbin/bacula-fd -f $OPTS -c $CONFIG -u root -g root +IOSchedulingClass=idle + +[Install] +WantedBy=multi-user.target diff --git a/bacula-fd.sysconfig b/bacula-fd.sysconfig new file mode 100644 index 0000000..1c959aa --- /dev/null +++ b/bacula-fd.sysconfig @@ -0,0 +1,5 @@ +# Add extra options to the bacula-fd daemon here + +# Useful for debugging +# +# OPTS="-d 200" diff --git a/bacula-sd.service b/bacula-sd.service new file mode 100644 index 0000000..d9e30d1 --- /dev/null +++ b/bacula-sd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Bacula StorageDaemon +Documentation=man:bacula-sd(8) +After=network.target nss-lookup.target + +[Service] +Environment=CONFIG=/etc/bacula/bacula-sd.conf +EnvironmentFile=-/etc/sysconfig/bacula-sd +ExecStart=/usr/sbin/bacula-sd -f $OPTS -c $CONFIG -u bacula -g tape + +[Install] +WantedBy=multi-user.target diff --git a/bacula-sd.sysconfig b/bacula-sd.sysconfig new file mode 100644 index 0000000..9a1a0f4 --- /dev/null +++ b/bacula-sd.sysconfig @@ -0,0 +1,5 @@ +# Add extra options to the bacula-sd daemon here + +# Useful for debugging +# +# OPTS="-d 200" diff --git a/bacula-seg-fault.patch b/bacula-seg-fault.patch new file mode 100644 index 0000000..b520ae4 --- /dev/null +++ b/bacula-seg-fault.patch @@ -0,0 +1,21 @@ +diff -Naur bacula-9.4.0.old/src/lib/message.c bacula-9.4.0/src/lib/message.c +--- bacula-9.4.0.old/src/lib/message.c 2018-12-16 11:30:25.000000000 +0100 ++++ bacula-9.4.0/src/lib/message.c 2019-01-12 15:20:25.794653213 +0100 +@@ -28,6 +28,7 @@ + * + */ + ++#include + #include "bacula.h" + #include "jcr.h" + +@@ -1413,7 +1414,8 @@ + + if (type == M_ABORT) { + char *p = 0; +- p[0] = 0; /* generate segmentation violation */ ++ // p[0] = 0; /* generate segmentation violation */ ++ assert(p!=NULL); + } + if (type == M_ERROR_TERM) { + exit(1); diff --git a/bacula-sqlite-priv.patch b/bacula-sqlite-priv.patch new file mode 100644 index 0000000..11d41a7 --- /dev/null +++ b/bacula-sqlite-priv.patch @@ -0,0 +1,9 @@ +diff -Naur bacula-9.0.4.old/src/cats/make_sqlite3_tables.in bacula-9.0.4/src/cats/make_sqlite3_tables.in +--- bacula-9.0.4.old/src/cats/make_sqlite3_tables.in 2017-09-15 13:38:22.717599355 +0200 ++++ bacula-9.0.4/src/cats/make_sqlite3_tables.in 2017-09-15 13:38:36.414851879 +0200 +@@ -481,4 +481,5 @@ + echo "" + + chmod 640 ${db_name}.db ++chown bacula:bacula ${db_name}.db + exit 0 diff --git a/bacula.logrotate b/bacula.logrotate new file mode 100644 index 0000000..c14fede --- /dev/null +++ b/bacula.logrotate @@ -0,0 +1,9 @@ +# Bacula logrotate script + +/var/log/bacula/*.log { + monthly + rotate 4 + notifempty + missingok +} + diff --git a/bacula.spec b/bacula.spec new file mode 100644 index 0000000..5d49bad --- /dev/null +++ b/bacula.spec @@ -0,0 +1,322 @@ +%global uid 133 +%global username bacula + +Name: bacula +Version: 9.4.4 +Release: 2 +Summary: Cross platform network backup for Linux, Unix, Mac and Windows +License: AGPLv3 with exceptions +URL: http://www.bacula.org +Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +Source6: bacula.logrotate +Source10: bacula-fd.service +Source11: bacula-dir.service +Source12: bacula-sd.service +Source15: bacula-fd.sysconfig +Source16: bacula-dir.sysconfig +Source17: bacula-sd.sysconfig +Patch0001: bacula-sqlite-priv.patch +Patch0002: bacula-seg-fault.patch +Patch0003: bacula-autoconf.patch + +BuildRequires: desktop-file-utils perl-generators sed autoconf automake lzo-devel zlib-devel +BuildRequires: gcc gcc-c++ glibc-devel ImageMagick libacl-devel libstdc++-devel libxml2-devel +BuildRequires: libcap-devel ncurses-devel openssl-devel readline-devel sqlite-devel +BuildRequires: qt5-qtbase-devel systemd mariadb-connector-c-devel perl-interpreter libpq-devel + +%description +Bacula is a set of programs that allow you to manage the backup, recovery, and +verification of computer data across a network of different computers. It is +based on a client/server architecture and is efficient and relatively easy to +use, while offering many advanced storage management features that make it easy +to find and recover lost or damaged files. + +%package_help + +%package common +Summary: Common Bacula files +Provides: bacula-libs = %{version}-%{release} bacula-libs-sql = %{version}-%{release} bacula-libs-sqlite = %{version}-%{release} +Obsoletes: bacula-libs < %{version}-%{release} bacula-sysconfdir <= 2.4 bacula-libs-sql < %{version}-%{release} +Provides: bacula-libs-mysql = %{version}-%{release} bacula-libs-postgresql = %{version}-%{release} +Obsoletes: bacula-libs-mysql <= 5.0.3 bacula-libs-sqlite <= 5.0.3 bacula-libs-postgresql <= 5.0.3 +Provides: group(%username) = %uid user(%username) = %uid bacula-director = %{version}-%{release} +Obsoletes: bacula-sysconfdir <= 2.4 bacula-director < %{version}-%{release} +Provides: bacula-director-common = %{version}-%{release} bacula-director-mysql = %{version}-%{release} +Obsoletes: bacula-director-common < 5.2.3-5 bacula-director-mysql < 5.2.3-5 +Provides: bacula-director-sqlite = %{version}-%{release} bacula-director-postgresql = %{version}-%{release} +Obsoletes: bacula-director-sqlite < 5.2.3-5 bacula-director-postgresql < 5.2.3-5 +Provides: bacula-storage-common = %{version}-%{release} bacula-storage = %{version}-%{release} +Obsoletes: bacula-storage-common < 5.2.2-2 bacula-storage < %{version}-%{release} +Provides: bacula-storage-mysql = %{version}-%{release} bacula-storage-sqlite = %{version}-%{release} +Obsoletes: bacula-storage-mysql < 5.2.0 bacula-storage-sqlite < 5.2.0 bacula-console-wxwidgets <= 5.0.3 +Provides: bacula-storage-postgresql = %{version}-%{release} bacula-console = %{version}-%{release} +Obsoletes: bacula-storage-postgresql < 5.2.0 bacula-console < %{version}-%{release} bacula-console-gnome <= 2.4 +Provides: bacula-console-bat = %{version}-%{release} bacula-traymonitor = %{version}-%{release} +Obsoletes: bacula-console-bat < %{version}-%{release} bacula-traymonitor < %{version}-%{release} +Requires: mt-st mtx dejavu-lgc-sans-fonts +Requires(pre): shadow-utils +Requires(postun): shadow-utils +%{?systemd requires} + +%description common +This package contains files common to all Bacula daemons. + +%package logwatch +Summary: Bacula Director logwatch scripts +BuildArch: noarch +Requires: bacula-common = %{version}-%{release} +Requires: logwatch + +%description logwatch +This package contains logwatch scripts for Bacula Director. + +%package client +Summary: Bacula backup client +Requires: bacula-common = %{version}-%{release} +%{?systemd requires} + +%description client +This package contains the bacula client, the daemon running on the system to be +backed up. + +%package devel +Summary: Bacula development files +Requires: bacula-common = %{version}-%{release} + +%description devel +This development package contains static libraries and header files. + +%package -n nagios-plugins-bacula +Summary: Nagios Plugin - check_bacula +Requires: bacula-common = %{version}-%{release} nagios-common%{?_isa} + +%description -n nagios-plugins-bacula +Provides check_bacula support for Nagios. + +%prep +%autosetup -p1 + +#cp %{SOURCE2} %{SOURCE3} %{SOURCE4} . + +pushd autoconf +sed -i -r 's/(hardcode_into_libs)=.*$/\1=no/' libtool/libtool.m4 +aclocal -I bacula-macros/ -I gettext-macros/ -I libtool/ +popd +autoconf -I autoconf/ -o configure autoconf/configure.in + +find updatedb -type f | xargs chmod -x + +%build +export CFLAGS="%{optflags} -I%{_includedir}/ncurses" +export CPPFLAGS="%{optflags} -I%{_includedir}/ncurses" +export PATH="$PATH:%{_qt5_bindir}" + +%configure \ + --with-x \ + --disable-s3 \ + --with-mysql \ + --enable-bat \ + --with-sqlite3 \ + --with-openssl \ + --disable-conio \ + --disable-rpath \ + --with-postgresql \ + --enable-readline \ + --enable-includes \ + --enable-largefile \ + --enable-build-dird \ + --enable-smartalloc \ + --enable-batch-insert \ + --enable-build-stored \ + --with-basename=bacula \ + --with-hostname=localhost \ + --with-smtp-host=localhost \ + --docdir=%{_datadir}/bacula \ + --with-plugindir=%{_libdir}/bacula \ + --sysconfdir=%{_sysconfdir}/bacula \ + --with-sd-password=@@SD_PASSWORD@@ \ + --with-fd-password=@@FD_PASSWORD@@ \ + --with-pid-dir=%{_localstatedir}/run \ + --with-dir-password=@@DIR_PASSWORD@@ \ + --with-scriptdir=%{_libexecdir}/bacula \ + --with-logdir=%{_localstatedir}/log/bacula \ + --with-mon-fd-password=@@MON_FD_PASSWORD@@ \ + --with-mon-sd-password=@@MON_SD_PASSWORD@@ \ + --with-mon-dir-password=@@MON_DIR_PASSWORD@@ \ + --with-bsrdir=%{_localstatedir}/spool/bacula \ + --with-subsys-dir=%{_localstatedir}/lock/subsys \ + --with-working-dir=%{_localstatedir}/spool/bacula \ + +%disable_rpath + +%make_build +%make_build -C examples/nagios/check_bacula + +pushd src/qt-console/tray-monitor + %{?qmake_qt5}%{!?qmake_qt5:qmake-qt5} tray-monitor.pro + %make_build + cp -f .libs/bacula-tray-monitor . +popd + + +%install +%make_install + +install -p -m 755 -D examples/nagios/check_bacula/.libs/check_bacula %{buildroot}%{_libdir}/nagios/plugins/check_bacula +install -p -m 644 -D src/qt-console/images/bat_icon.png %{buildroot}%{_datadir}/pixmaps/bat_icon.png +install -p -m 644 -D scripts/bat.desktop %{buildroot}%{_datadir}/applications/bat.desktop +install -p -m 755 -D src/qt-console/.libs/bat %{buildroot}%{_sbindir}/bat +install -p -m 755 -D src/qt-console/tray-monitor/bacula-tray-monitor %{buildroot}%{_sbindir}/bacula-tray-monitor +install -p -m 644 -D src/qt-console/tray-monitor/tray-monitor.conf %{buildroot}%{_sysconfdir}/bacula/tray-monitor.conf +install -p -m 644 -D manpages/bacula-tray-monitor.1 %{buildroot}%{_mandir}/man1/bacula-tray-monitor.1 +install -p -m 644 -D scripts/bacula-tray-monitor.desktop %{buildroot}%{_datadir}/applications/bacula-tray-monitor.desktop +mkdir -p %{buildroot}%{_localstatedir}/log/bacula +install -p -m 644 -D %{SOURCE6} %{buildroot}%{_sysconfdir}/logrotate.d/bacula +install -p -m 755 -D scripts/logwatch/bacula %{buildroot}%{_sysconfdir}/logwatch/scripts/services/bacula +install -p -m 644 -D scripts/logwatch/logfile.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/logfiles/bacula.conf +install -p -m 644 -D scripts/logwatch/services.bacula.conf %{buildroot}%{_sysconfdir}/logwatch/conf/services/bacula.conf +install -p -m 755 -D scripts/logwatch/applybaculadate %{buildroot}%{_sysconfdir}/logwatch/scripts/shared/applybaculadate +mkdir -p %{buildroot}%{_unitdir} +install -p -m 644 -D %{SOURCE10} %{buildroot}%{_unitdir}/bacula-fd.service +install -p -m 644 -D %{SOURCE11} %{buildroot}%{_unitdir}/bacula-dir.service +install -p -m 644 -D %{SOURCE12} %{buildroot}%{_unitdir}/bacula-sd.service +install -p -m 644 -D %{SOURCE15} %{buildroot}%{_sysconfdir}/sysconfig/bacula-fd +install -p -m 644 -D %{SOURCE16} %{buildroot}%{_sysconfdir}/sysconfig/bacula-dir +install -p -m 644 -D %{SOURCE17} %{buildroot}%{_sysconfdir}/sysconfig/bacula-sd +mkdir -p %{buildroot}%{_localstatedir}/spool/bacula + +rm -f %{buildroot}%{_libdir}/*.la +rm -f %{buildroot}%{_sbindir}/bacula +rm -f %{buildroot}%{_libdir}/libbaccats.so +rm -f %{buildroot}%{_mandir}/man8/bacula.8.gz +rm -f %{buildroot}%{_datadir}/bacula/{ChangeLog,INSTALL,LICENSE*,README,ReleaseNotes,VERIFYING,technotes} +rm -f %{buildroot}%{_libexecdir}/bacula/{bacula,bacula-ctl-*,startmysql,stopmysql,bconsole,make_catalog_backup} + +chmod 755 %{buildroot}%{_sbindir}/* +chmod 755 %{buildroot}%{_libdir}/bacula/* +chmod 755 %{buildroot}%{_libexecdir}/bacula/* +chmod 644 %{buildroot}%{_libexecdir}/bacula/btraceback.* + +%ldconfig_scriptlets common + +%pre common +getent group %username >/dev/null || groupadd -g %uid -r %username &>/dev/null || : +getent passwd %username >/dev/null || useradd -u %uid -r -s /sbin/nologin \ + -d /var/spool/bacula -M -c 'Bacula Backup System' -g %username %username &>/dev/null || : +exit 0 + +%post common +/usr/sbin/alternatives --install %{_libdir}/libbaccats.so libbaccats.so %{_libdir}/libbaccats-mysql.so 50 +/usr/sbin/alternatives --install %{_libdir}/libbaccats.so libbaccats.so %{_libdir}/libbaccats-sqlite3.so 40 +/usr/sbin/alternatives --install %{_libdir}/libbaccats.so libbaccats.so %{_libdir}/libbaccats-postgresql.so 60 + +if readlink /etc/alternatives/libbaccats.so | grep --silent mysql || \ + readlink /etc/alternatives/bacula-dir | grep --silent mysql || \ + readlink /etc/alternatives/bacula-sd | grep --silent mysql; then + /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-mysql.so +elif readlink /etc/alternatives/libbaccats.so | grep --silent sqlite || \ + readlink /etc/alternatives/bacula-dir | grep --silent sqlite || \ + readlink /etc/alternatives/bacula-sd | grep --silent sqlite; then + /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-sqlite3.so +else + /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-postgresql.so +fi +%{?ldconfig} +%systemd_post %{name}-dir.service %{name}-sd.service + +%ldconfig_postun common + +%preun common +if [ "$1" = 0 ]; then + /usr/sbin/alternatives --remove libbaccats.so %{_libdir}/libbaccats-mysql.so + /usr/sbin/alternatives --remove libbaccats.so %{_libdir}/libbaccats-sqlite3.so + /usr/sbin/alternatives --remove libbaccats.so %{_libdir}/libbaccats-postgresql.so +fi +%systemd_preun %{name}-dir.service %{name}-sd.service + +%postun common +%systemd_postun_with_restart %{name}-dir.service %{name}-sd.service + +%post client +%systemd_post bacula-fd.service + +%preun client +%systemd_preun bacula-fd.service + +%postun client +%systemd_postun_with_restart bacula-fd.service + +%files common +%defattr(-,root,root) +%doc SUPPORT ReleaseNotes +%doc updatedb examples/sample-query.sql +%license LICENSE COPYING COPYRIGHT LICENSE-FAQ LICENSE-FOSS +%config(noreplace) %{_sysconfdir}/logrotate.d/bacula +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-sd +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-dir +%config(noreplace) %{_sysconfdir}/bacula/bat.conf %attr(640,root,root) +%config(noreplace) /usr/libexec/bacula/query.sql %attr(640,root,bacula) +%config(noreplace) %{_sysconfdir}/bacula/bconsole.conf %attr(640,root,root) +%config(noreplace) %{_sysconfdir}/bacula/bacula-sd.conf %attr(640,root,root) +%config(noreplace) %{_sysconfdir}/bacula/tray-monitor.conf %attr(640,root,root) +%config(noreplace) %{_sysconfdir}/bacula/bacula-dir.conf %attr(640,root,bacula) +%{_sbindir}/* +%{_unitdir}/bacula-sd.service +%{_unitdir}/bacula-dir.service +%{_libdir}/*.so +%dir %{_localstatedir}/log/bacula %attr(750, bacula, bacula) +%dir %{_localstatedir}/spool/bacula %attr(750, bacula, bacula) +%dir %{_libexecdir}/%{name} +%dir %{_sysconfdir}/%{name} %attr(755,root,root) +%{_libexecdir}/%{name}/* +%{_datadir}/bacula/*.png +%{_datadir}/bacula/*.html +%{_datadir}/pixmaps/bat_icon.png +%{_datadir}/applications/bat.desktop +%{_datadir}/applications/bacula-tray-monitor.desktop +%exclude %{_sbindir}/bfdjson +%exclude %{_sbindir}/bacula-fd +%exclude %{_libdir}/libbac.so +%exclude %{_libdir}/libbacsd.so +%exclude %{_libdir}/libbacsql.so +%exclude %{_libdir}/libbaccfg.so +%exclude %{_libdir}/libbacfind.so +%exclude %{_libdir}/libbaccats-%{version}.so + +%files logwatch +%defattr(-,root,root) +%config(noreplace) %{_sysconfdir}/logwatch/conf/logfiles/bacula.conf +%config(noreplace) %{_sysconfdir}/logwatch/conf/services/bacula.conf +%{_sysconfdir}/logwatch/scripts/services/bacula +%{_sysconfdir}/logwatch/scripts/shared/applybaculadate + +%files client +%defattr(-,root,root) +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-fd +%config(noreplace) %{_sysconfdir}/bacula/bacula-fd.conf %attr(640,root,root) +%{_sbindir}/bfdjson +%{_sbindir}/bacula-fd +%{_unitdir}/bacula-fd.service +%{_libdir}/bacula/bpipe-fd.so + +%files devel +%defattr(-,root,root) +%{_includedir}/bacula +%{_libdir}/libbac.so +%{_libdir}/libbacsd.so +%{_libdir}/libbaccfg.so +%{_libdir}/libbacsql.so +%{_libdir}/libbacfind.so + +%files -n nagios-plugins-bacula +%defattr(-,root,root) +%{_libdir}/nagios/plugins/check_bacula + +%files help +%defattr(-,root,root) +%doc AUTHORS ChangeLog README README.AIX SUPPORT VERIFYING +%{_mandir}/man* + +%changelog +* Thu Nov 21 2019 openEuler Buildteam - 9.4.4-2 +- Package init