1#
2# spec file for package bareos
3# Copyright (c) 2011-2012 Bruno Friedmann (Ioda-Net) and Philipp Storz (dass IT)
4#               2013-2018 Bareos GmbH & Co KG
5#
6
7Name: 		bareos
8Version: 	0.0.0
9Release: 	0
10Group: 		Productivity/Archiving/Backup
11License: 	AGPL-3.0
12BuildRoot: 	%{_tmppath}/%{name}-root
13URL: 		http://www.bareos.org/
14Vendor: 	The Bareos Team
15#Packager: 	{_packager}
16
17%define library_dir    %{_libdir}/%{name}
18%define backend_dir    %{_libdir}/%{name}/backends
19%define plugin_dir     %{_libdir}/%{name}/plugins
20%define script_dir     /usr/lib/%{name}/scripts
21%define working_dir    /var/lib/%{name}
22%define pid_dir        /var/lib/%{name}
23%define bsr_dir        /var/lib/%{name}
24# TODO: use /run ?
25%define _subsysdir     /var/lock
26
27#
28# Generic daemon user and group
29#
30%define daemon_user             bareos
31%define daemon_group            bareos
32
33%define director_daemon_user    %{daemon_user}
34%define storage_daemon_user     %{daemon_user}
35%define file_daemon_user        root
36%define storage_daemon_group    %{daemon_group}
37
38# default settings
39%define client_only 0
40%define build_qt_monitor 1
41%define build_sqlite3 1
42%define glusterfs 0
43%define droplet 0
44%define have_git 1
45%define ceph 0
46%define install_suse_fw 0
47%define systemd_support 0
48%define python_plugins 1
49
50# cmake build directory
51%define CMAKE_BUILDDIR       cmake-build
52
53# fedora 28 deprecated libwrap
54%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
55%define use_libwrap 0
56%else
57%define use_libwrap 1
58%endif
59
60# rhel/centos 6 must not be built with libtirpc installed
61%if 0%{?rhel} == 6
62BuildConflicts: libtirpc-devel
63%endif
64
65# fedora 28: rpc was removed from libc
66%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
67BuildRequires: rpcgen
68BuildRequires: libtirpc-devel
69%endif
70
71#
72# SUSE (openSUSE, SLES) specific settigs
73#
74%if 0%{?sles_version} == 10
75%define build_qt_monitor 0
76%define build_sqlite3 0
77%define have_git 0
78%define python_plugins 0
79%endif
80
81%if 0%{?suse_version} > 1010
82%define install_suse_fw 1
83%define _fwdefdir   %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
84%endif
85
86
87%if 0%{?suse_version} > 1140
88%define systemd_support 1
89%endif
90
91# SLE 12
92# SLE_15: droplet is not available due to SSL build problems
93%if 0%{?sle_version} >= 120000 && 0%{?sle_version} < 150000
94%define droplet 1
95%endif
96
97%if 0%{?sle_version} >= 120000
98%define ceph 1
99%endif
100
101#
102# RedHat (CentOS, Fedora, RHEL) specific settings
103#
104%if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500
105%define RHEL4 1
106%define client_only 1
107%define build_qt_monitor 0
108%define build_sqlite3 0
109%define have_git 0
110%define python_plugins 0
111%endif
112
113# centos/rhel 5: segfault when building qt monitor
114%if 0%{?centos_version} == 505 || 0%{?rhel_version} == 505
115%define build_qt_monitor 0
116%define have_git 0
117%define python_plugins 0
118%endif
119
120%if 0%{?fedora_version} >= 20
121%define glusterfs 1
122%define systemd_support 1
123%endif
124
125%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
126%define glusterfs 1
127%define droplet 1
128%define systemd_support 1
129%endif
130
131%if 0%{?rhel_version} == 800
132%define droplet 0
133%endif
134
135%if 0%{?rhel_version} >= 700 && !0%{?centos_version}
136%define ceph 1
137%endif
138
139%if 0%{?centos} >= 8
140%define ceph 1
141%endif
142
143# use Developer Toolset 7 compiler as standard is too old
144%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
145BuildRequires: devtoolset-7-gcc
146BuildRequires: devtoolset-7-gcc-c++
147%endif
148
149%if 0%{?systemd_support}
150BuildRequires: systemd
151# see https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
152%if 0%{?suse_version} >= 1210
153BuildRequires: systemd-rpm-macros
154%endif
155%{?systemd_requires}
156%endif
157
158%if 0%{?droplet}
159BuildRequires: libdroplet-devel
160%endif
161
162%if 0%{?glusterfs}
163BuildRequires: glusterfs-devel glusterfs-api-devel
164%endif
165
166%if 0%{?ceph}
167  %if 0%{?sle_version} >= 120200
168BuildRequires: libcephfs-devel
169BuildRequires: librados-devel
170  %else
171# the rhel macro is set in docker, but not in obs
172    %if 0%{?rhel} == 7
173BuildRequires: librados2-devel
174BuildRequires: libcephfs1-devel
175    %else
176      %if 0%{?rhel} == 8
177BuildRequires: librados-devel
178BuildRequires: libradosstriper-devel
179BuildRequires: libcephfs-devel
180      %else
181BuildRequires: ceph-devel
182      %endif
183    %endif
184  %endif
185%endif
186
187%if 0%{?have_git}
188BuildRequires: git-core
189%endif
190
191Source0: %{name}-%{version}.tar.bz2
192
193BuildRequires: pam-devel
194
195BuildRequires: cmake
196BuildRequires: gcc
197BuildRequires: gcc-c++
198BuildRequires: make
199BuildRequires: glibc
200BuildRequires: glibc-devel
201BuildRequires: ncurses-devel
202BuildRequires: perl
203BuildRequires: readline-devel
204BuildRequires: libstdc++-devel
205BuildRequires: zlib-devel
206BuildRequires: openssl-devel
207BuildRequires: libacl-devel
208BuildRequires: pkgconfig
209BuildRequires: lzo-devel
210BuildRequires: libfastlz-devel
211BuildRequires: logrotate
212%if 0%{?build_sqlite3}
213%if 0%{?suse_version}
214BuildRequires: sqlite3-devel
215%else
216BuildRequires: sqlite-devel
217%endif
218%endif
219BuildRequires: mysql-devel
220BuildRequires: postgresql-devel
221BuildRequires: openssl
222BuildRequires: libcap-devel
223BuildRequires: mtx
224
225%if 0%{?build_qt_monitor}
226%if 0%{?suse_version}
227BuildRequires: libqt5-qtbase-devel
228%else
229
230%if 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?fedora} >= 29
231BuildRequires: qt5-qtbase-devel
232%else
233BuildRequires: qt-devel
234%endif
235
236%endif
237%endif
238
239
240%if 0%{?python_plugins}
241%if 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?fedora} >= 31
242BuildRequires: python2-devel >= 2.6
243%else
244BuildRequires: python-devel >= 2.6
245%endif
246%endif
247
248%if 0%{?suse_version}
249
250# suse_version:
251#   1315: SLE_12
252#   1110: SLE_11
253#   1010: SLE_10
254
255BuildRequires: distribution-release
256BuildRequires: pwdutils
257BuildRequires: tcpd-devel
258BuildRequires: termcap
259BuildRequires: update-desktop-files
260
261%if 0%{?suse_version} > 1010
262# link identical files
263BuildRequires: fdupes
264BuildRequires: libjansson-devel
265BuildRequires: lsb-release
266%endif
267
268%else
269# non suse
270
271BuildRequires: libtermcap-devel
272BuildRequires: passwd
273
274%if %{use_libwrap}
275BuildRequires: tcp_wrappers
276%endif
277
278# Some magic to be able to determine what platform we are running on.
279%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
280
281BuildRequires: redhat-lsb
282
283# older versions require additional release packages
284%if 0%{?rhel_version}   && 0%{?rhel_version} <= 600
285BuildRequires: redhat-release
286%endif
287
288%if 0%{?centos_version} && 0%{?centos_version} <= 600
289BuildRequires: redhat-release
290%endif
291
292%if 0%{?fedora_version}
293BuildRequires: fedora-release
294%endif
295
296%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version} >= 14
297BuildRequires: jansson-devel
298%if %{use_libwrap}
299BuildRequires: tcp_wrappers-devel
300%endif
301%endif
302%else
303# non suse, non redhat: eg. mandriva.
304
305BuildRequires: lsb-release
306
307%endif
308
309%endif
310
311
312Summary:    Backup Archiving REcovery Open Sourced - metapackage
313Requires:   %{name}-director = %{version}
314Requires:   %{name}-storage = %{version}
315Requires:   %{name}-client = %{version}
316
317%if 0%{?RHEL4}
318%define dscr Bareos - Backup Archiving Recovery Open Sourced.
319%else
320%define dscr Bareos - Backup Archiving Recovery Open Sourced. \
321Bareos is a set of computer programs that permit you (or the system \
322administrator) to manage backup, recovery, and verification of computer \
323data across a network of computers of different kinds. In technical terms, \
324it is a network client/server based backup program. Bareos is relatively \
325easy to use and efficient, while offering many advanced storage management \
326features that make it easy to find and recover lost or damaged files. \
327Bareos source code has been released under the AGPL version 3 license.
328%endif
329
330%description
331%{dscr}
332
333%if 0%{?opensuse_version} || 0%{?sle_version}
334%debug_package
335%endif
336
337# Notice : Don't try to change the order of package declaration
338# You will have side effect with PreReq
339
340%package    bconsole
341Summary:    Bareos administration console (CLI)
342Group:      Productivity/Archiving/Backup
343Requires:   %{name}-common = %{version}
344
345%package    client
346Summary:    Bareos client Meta-All-In-One package
347Group:      Productivity/Archiving/Backup
348Requires:   %{name}-bconsole = %{version}
349Requires:   %{name}-filedaemon = %{version}
350%if 0%{?suse_version}
351Recommends: %{name}-traymonitor = %{version}
352%endif
353
354%package    director
355Summary:    Bareos Director daemon
356Group:      Productivity/Archiving/Backup
357Requires:   %{name}-common = %{version}
358Requires:   %{name}-database-common = %{version}
359Requires:   %{name}-database-tools
360%if 0%{?suse_version}
361Requires(pre): pwdutils
362# Don't use this option on anything other then SUSE derived distributions
363# as Fedora & others don't know this tag
364Recommends: logrotate
365%else
366Requires(pre): shadow-utils
367%endif
368Provides:   %{name}-dir
369
370%package    storage
371Summary:    Bareos Storage daemon
372Group:      Productivity/Archiving/Backup
373Requires:   %{name}-common = %{version}
374Provides:   %{name}-sd
375%if 0%{?suse_version}
376Requires(pre): pwdutils
377Recommends: bareos-tools
378%else
379Requires(pre): shadow-utils
380# Recommends would be enough, however only supported by Fedora >= 24.
381Requires: bareos-tools
382%endif
383
384%if 0%{?droplet}
385%package    storage-droplet
386Summary:    Object Storage support (through libdroplet) for the Bareos Storage daemon
387Group:      Productivity/Archiving/Backup
388Requires:   %{name}-common  = %{version}
389Requires:   %{name}-storage = %{version}
390%endif
391
392%if 0%{?glusterfs}
393%package    storage-glusterfs
394Summary:    GlusterFS support for the Bareos Storage daemon
395Group:      Productivity/Archiving/Backup
396Requires:   %{name}-common  = %{version}
397Requires:   %{name}-storage = %{version}
398Requires:   glusterfs
399%endif
400
401%if 0%{?ceph}
402%package    storage-ceph
403Summary:    CEPH support for the Bareos Storage daemon
404Group:      Productivity/Archiving/Backup
405Requires:   %{name}-common  = %{version}
406Requires:   %{name}-storage = %{version}
407%endif
408
409%package    storage-tape
410Summary:    Tape support for the Bareos Storage daemon
411Group:      Productivity/Archiving/Backup
412Requires:   %{name}-common  = %{version}
413Requires:   %{name}-storage = %{version}
414Requires:   mtx
415%if !0%{?suse_version}
416Requires:   mt-st
417%endif
418
419%package    storage-fifo
420Summary:    FIFO support for the Bareos Storage backend
421Group:      Productivity/Archiving/Backup
422Requires:   %{name}-common  = %{version}
423Requires:   %{name}-storage = %{version}
424
425%package    filedaemon
426Summary:    Bareos File daemon (backup and restore client)
427Group:      Productivity/Archiving/Backup
428Requires:   %{name}-common = %{version}
429Provides:   %{name}-fd
430%if 0%{?suse_version}
431Requires(pre): pwdutils
432%else
433Requires(pre): shadow-utils
434%endif
435
436%package    common
437Summary:    Common files, required by multiple Bareos packages
438Group:      Productivity/Archiving/Backup
439Requires:   openssl
440%if 0%{?suse_version}
441Requires(pre): pwdutils
442%else
443Requires(pre): shadow-utils
444%endif
445Provides:   %{name}-libs
446
447%package    database-common
448Summary:    Generic abstraction libs and files to connect to a database
449Group:      Productivity/Archiving/Backup
450Requires:   %{name}-common = %{version}
451Requires:   %{name}-database-backend = %{version}
452Requires:   openssl
453Provides:   %{name}-sql
454
455%package    database-postgresql
456Summary:    Libs & tools for postgresql catalog
457Group:      Productivity/Archiving/Backup
458Requires:   %{name}-database-common = %{version}
459Provides:   %{name}-catalog-postgresql
460Provides:   %{name}-database-backend
461
462%package    database-mysql
463Summary:    Libs & tools for mysql catalog
464Group:      Productivity/Archiving/Backup
465Requires:   %{name}-database-common = %{version}
466Provides:   %{name}-catalog-mysql
467Provides:   %{name}-database-backend
468
469%if 0%{?build_sqlite3}
470%package    database-sqlite3
471Summary:    Libs & tools for sqlite3 catalog
472Group:      Productivity/Archiving/Backup
473%if 0%{?suse_version}
474Requires:   sqlite3
475%endif
476%if 0%{?fedora_version}
477Requires:   sqlite
478%endif
479Requires:   %{name}-database-common = %{version}
480Provides:   %{name}-catalog-sqlite3
481Provides:   %{name}-database-backend
482%endif
483
484%package    database-tools
485Summary:    Bareos CLI tools with database dependencies (bareos-dbcheck, bscan)
486Group:      Productivity/Archiving/Backup
487Requires:   %{name}-common = %{version}
488Requires:   %{name}-database-common = %{version}
489Provides:   %{name}-dbtools
490
491%package    tools
492Summary:    Bareos CLI tools (bcopy, bextract, bls, bregex, bwild)
493Group:      Productivity/Archiving/Backup
494Requires:   %{name}-common = %{version}
495
496%if 0%{build_qt_monitor}
497%package    traymonitor
498Summary:    Bareos Tray Monitor (QT)
499Group:      Productivity/Archiving/Backup
500# Added to by pass the 09 checker rules (conflict with bareos-tray-monitor.conf)
501# This is mostly wrong cause the two binaries can use it!
502Conflicts:  %{name}-tray-monitor-gtk
503Provides:   %{name}-tray-monitor-qt
504%endif
505
506%package    devel
507Summary:    Devel headers
508Group:      Development/Languages/C and C++
509Requires:   %{name}-common = %{version}
510Requires:   zlib-devel
511Requires:   libacl-devel
512Requires:   postgresql-devel
513Requires:   libcap-devel
514%if 0%{?build_sqlite3}
515%if 0%{?suse_version}
516Requires:   sqlite3-devel
517%else
518Requires:   sqlite-devel
519%endif
520%endif
521%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
522Requires:   openssl-devel
523%else
524Requires:   libopenssl-devel
525%endif
526%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version}
527%if %{use_libwrap}
528Requires:   tcp_wrappers-devel
529%endif
530%else
531%if 0%{?rhel_version} || 0%{?centos_version}
532%if %{use_libwrap}
533Requires:   tcp_wrappers
534%endif
535%else
536Requires:   tcpd-devel
537%endif
538%endif
539%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700 || 0%{?fedora_version} >= 19
540Requires:   mariadb-devel
541%else
542%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
543Requires:   mysql-devel
544%else
545Requires:   libmysqlclient-devel
546%endif
547%endif
548
549%package    regress-config
550Summary:    Required files for bareos-regress
551Group:      Development/Languages/C and C++
552Requires:   %{name}-common = %{version}
553
554%if 0%{?python_plugins}
555%package    director-python-plugin
556Summary:    Python plugin for Bareos Director daemon
557Group:      Productivity/Archiving/Backup
558Requires:   bareos-director = %{version}
559
560%package    filedaemon-python-plugin
561Summary:    Python plugin for Bareos File daemon
562Group:      Productivity/Archiving/Backup
563Requires:   bareos-filedaemon = %{version}
564
565%package    filedaemon-ldap-python-plugin
566Summary:    LDAP Python plugin for Bareos File daemon
567Group:      Productivity/Archiving/Backup
568Requires:   bareos-filedaemon = %{version}
569Requires:   bareos-filedaemon-python-plugin = %{version}
570Requires:   python-ldap
571
572%package    storage-python-plugin
573Summary:    Python plugin for Bareos Storage daemon
574Group:      Productivity/Archiving/Backup
575Requires:   bareos-storage = %{version}
576
577%description director-python-plugin
578%{dscr}
579
580This package contains the python plugin for the director daemon
581
582%description filedaemon-python-plugin
583%{dscr}
584
585This package contains the python plugin for the file daemon
586
587%description filedaemon-ldap-python-plugin
588%{dscr}
589
590This package contains the LDAP python plugin for the file daemon
591
592%description storage-python-plugin
593%{dscr}
594
595This package contains the python plugin for the storage daemon
596
597%endif
598
599%if 0%{?glusterfs}
600%package    filedaemon-glusterfs-plugin
601Summary:    GlusterFS plugin for Bareos File daemon
602Group:      Productivity/Archiving/Backup
603Requires:   bareos-filedaemon = %{version}
604Requires:   glusterfs
605
606%description filedaemon-glusterfs-plugin
607%{dscr}
608
609This package contains the GlusterFS plugin for the file daemon
610
611%endif
612
613%if 0%{?ceph}
614%package    filedaemon-ceph-plugin
615Summary:    CEPH plugin for Bareos File daemon
616Group:      Productivity/Archiving/Backup
617Requires:   bareos-filedaemon = %{version}
618
619%description filedaemon-ceph-plugin
620%{dscr}
621
622This package contains the CEPH plugins for the file daemon
623
624%endif
625
626%description client
627%{dscr}
628
629This package is a meta package requiring the packages
630containing the fd and the console.
631
632This is for client only installation.
633
634%description bconsole
635%{dscr}
636
637This package contains the bconsole (the CLI interface program)
638
639%description director
640%{dscr}
641
642This package contains the Director Service (Bareos main service daemon)
643
644%description storage
645%{dscr}
646
647This package contains the Storage Daemon
648(Bareos service to read and write data from/to media)
649
650%description storage-tape
651%{dscr}
652
653This package contains the Storage Daemon tape support
654(Bareos service to read and write data from/to tape media)
655
656%if 0%{?droplet}
657%description storage-droplet
658%{dscr}
659
660This package contains the Storage backend for Object Storage (through libdroplet).
661%endif
662
663%if 0%{?glusterfs}
664%description storage-glusterfs
665%{dscr}
666
667This package contains the Storage backend for GlusterFS.
668%endif
669
670%if 0%{?ceph}
671%description storage-ceph
672%{dscr}
673
674This package contains the Storage backend for CEPH.
675%endif
676
677%description storage-fifo
678%{dscr}
679
680This package contains the Storage backend for FIFO files.
681This package is only required, when a resource "Archive Device = fifo"
682should be used by the Bareos Storage Daemon.
683
684%description filedaemon
685%{dscr}
686
687This package contains the File Daemon
688(Bareos client daemon to read/write data from the backed up computer)
689
690%description common
691%{dscr}
692
693This package contains the shared libraries that are used by multiple daemons and tools.
694
695%description database-common
696%{dscr}
697
698This package contains the shared libraries that abstract the catalog interface
699
700%description database-postgresql
701%{dscr}
702
703This package contains the shared library to access postgresql as catalog db.
704
705%description database-mysql
706%{dscr}
707
708This package contains the shared library to use mysql as catalog db.
709
710%if 0%{?build_sqlite3}
711%description database-sqlite3
712%{dscr}
713
714This package contains the shared library to use sqlite as catalog db.
715%endif
716
717%description database-tools
718%{dscr}
719
720This package contains Bareos database tools.
721
722%description tools
723%{dscr}
724
725This package contains Bareos tools.
726
727%if 0%{?build_qt_monitor}
728%description traymonitor
729%{dscr}
730
731This package contains the tray monitor (QT based).
732%endif
733
734%description devel
735%{dscr}
736
737This package contains bareos development files.
738
739%description regress-config
740%{dscr}
741
742This package contains required files for Bareos regression testing.
743
744
745
746%prep
747%setup
748
749%build
750# Cleanup defined in Fedora Packaging:Guidelines
751# and required repetitive local build of at least CentOS 5.
752if [ "%{?buildroot}" -a "%{?buildroot}" != "/" ]; then
753    rm -rf "%{?buildroot}"
754fi
755%if !0%{?suse_version}
756export PATH=$PATH:/usr/lib64/qt5/bin:/usr/lib/qt5/bin
757%endif
758export MTX=/usr/sbin/mtx
759
760
761mkdir %{CMAKE_BUILDDIR}
762pushd %{CMAKE_BUILDDIR}
763
764# use Developer Toolset 7 compiler as standard is too old
765%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
766export PATH=/opt/rh/devtoolset-7/root/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
767%endif
768
769CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
770CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;
771
772# use our own cmake call instead of cmake macro as it is different on different platforms/versions
773cmake  .. \
774      -DCMAKE_VERBOSE_MAKEFILE=ON \
775      -DCMAKE_INSTALL_PREFIX:PATH=/usr \
776      -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
777      -DINCLUDE_INSTALL_DIR:PATH=/usr/include \
778      -DLIB_INSTALL_DIR:PATH=/usr/lib \
779      -DSYSCONF_INSTALL_DIR:PATH=/etc \
780      -DSHARE_INSTALL_PREFIX:PATH=/usr/share \
781      -DBUILD_SHARED_LIBS:BOOL=ON \
782  -Dprefix=%{_prefix}\
783  -Dlibdir=%{library_dir} \
784  -Dsbindir=%{_sbindir} \
785  -Dsbin-perm=755 \
786  -Dsysconfdir=%{_sysconfdir} \
787  -Dconfdir=%{_sysconfdir}/bareos \
788  -Dmandir=%{_mandir} \
789  -Ddocdir=%{_docdir}/%{name} \
790  -Dhtmldir=%{_docdir}/%{name}/html \
791  -Darchivedir=/var/lib/%{name}/storage \
792  -Dbackenddir=%{backend_dir} \
793  -Dscriptdir=%{script_dir} \
794  -Dworkingdir=%{working_dir} \
795  -Dplugindir=%{plugin_dir} \
796  -Dpiddir=%{pid_dir} \
797  -Dbsrdir=%{bsr_dir} \
798  -Dlogdir=/var/log/bareos \
799  -Dsubsysdir=%{_subsysdir} \
800%if 0%{?python_plugins}
801  -Dpython=yes \
802%endif
803  -Dsmartalloc=yes \
804  -Dreadline=yes \
805  -Dbatch-insert=yes \
806  -Ddynamic-cats-backends=yes \
807  -Ddynamic-storage-backends=yes \
808  -Dscsi-crypto=yes \
809  -Dlmdb=yes \
810  -Dndmp=yes \
811  -Dipv6=yes \
812  -Dacl=yes \
813  -Dxattr=yes \
814%if 0%{?build_bat}
815  -Dbat=yes \
816%endif
817%if 0%{?build_qt_monitor}
818  -Dtraymonitor=yes \
819%endif
820%if 0%{?client_only}
821  -Dclient-only=yes \
822%endif
823  -Dpostgresql=yes \
824  -Dmysql=yes \
825%if 0%{?build_sqlite3}
826  -Dsqlite3=yes \
827%endif
828%if %{use_libwrap}
829  -Dtcp-wrappers=yes \
830%endif
831  -Ddir-user=%{director_daemon_user} \
832  -Ddir-group=%{daemon_group} \
833  -Dsd-user=%{storage_daemon_user} \
834  -Dsd-group=%{storage_daemon_group} \
835  -Dfd-user=%{file_daemon_user} \
836  -Dfd-group=%{daemon_group} \
837  -Ddir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
838  -Dfd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
839  -Dsd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
840  -Dmon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
841  -Dmon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
842  -Dmon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
843  -Dopenssl=yes \
844  -Dbasename="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
845  -Dhostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
846%if 0%{?systemd_support}
847  -Dsystemd=yes \
848%endif
849  -Dincludes=yes \
850  -DVERSION_STRING=%version
851
852#Add flags
853%__make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags};
854
855%check
856# run unit tests
857pushd %{CMAKE_BUILDDIR}
858make check
859
860%install
861##if 0#{?suse_version}
862#    #makeinstall DESTDIR=#{buildroot} install
863##else
864#    make DESTDIR=#{buildroot} install
865##endif
866#make DESTDIR=#{buildroot} install-autostart
867
868pushd %{CMAKE_BUILDDIR}
869make  DESTDIR=%{buildroot} install
870
871popd
872
873#rm -Rvf build
874
875
876install -d -m 755 %{buildroot}/usr/share/applications
877install -d -m 755 %{buildroot}/usr/share/pixmaps
878install -d -m 755 %{buildroot}%{backend_dir}
879install -d -m 755 %{buildroot}%{working_dir}
880install -d -m 755 %{buildroot}%{plugin_dir}
881
882#Cleaning
883for F in  \
884%if 0%{?client_only}
885    %{_mandir}/man1/bregex.1.gz \
886    %{_mandir}/man1/bsmtp.1.gz \
887    %{_mandir}/man1/bwild.1.gz \
888    %{_mandir}/man8/bareos-dbcheck.8.gz \
889    %{_mandir}/man8/bareos-dir.8.gz \
890    %{_mandir}/man8/bareos-sd.8.gz \
891    %{_mandir}/man8/bareos.8.gz \
892    %{_mandir}/man8/bcopy.8.gz \
893    %{_mandir}/man8/bextract.8.gz \
894    %{_mandir}/man8/bls.8.gz \
895    %{_mandir}/man8/bpluginfo.8.gz \
896    %{_mandir}/man8/bscan.8.gz \
897    %{_mandir}/man8/bscrypto.8.gz \
898    %{_mandir}/man8/btape.8.gz \
899    %{_sysconfdir}/logrotate.d/bareos-dir \
900    %{_sysconfdir}/rc.d/init.d/bareos-dir \
901    %{_sysconfdir}/rc.d/init.d/bareos-sd \
902    %{script_dir}/disk-changer \
903    %{script_dir}/mtx-changer \
904    %{_sysconfdir}/%{name}/mtx-changer.conf \
905%endif
906%if 0%{?install_suse_fw} == 0
907    %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-dir \
908    %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-sd \
909    %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-fd \
910%endif
911%if 0%{?systemd_support}
912    %{_sysconfdir}/rc.d/init.d/bareos-dir \
913    %{_sysconfdir}/rc.d/init.d/bareos-sd \
914    %{_sysconfdir}/rc.d/init.d/bareos-fd \
915    %{_sysconfdir}/init.d/bareos-dir \
916    %{_sysconfdir}/init.d/bareos-sd \
917    %{_sysconfdir}/init.d/bareos-fd \
918%endif
919    %{script_dir}/bareos_config \
920    %{script_dir}/btraceback.dbx \
921    %{script_dir}/btraceback.mdb \
922    %{_docdir}/%{name}/INSTALL \
923    %{_sbindir}/%{name}
924do
925rm -f "%{buildroot}/$F"
926done
927
928# remove links to libraries
929# for i in #{buildroot}/#{_libdir}/libbareos*; do printf "$i: "; readelf -a $i | grep SONAME; done
930find %{buildroot}/%{library_dir} -type l -name "libbareos*.so" -maxdepth 1 -exec rm {} \;
931ls -la %{buildroot}/%{library_dir}
932
933%if ! 0%{?python_plugins}
934rm -f %{buildroot}/%{plugin_dir}/python-*.so
935rm -f %{buildroot}/%{plugin_dir}/*.py*
936rm -f %{buildroot}/%{_sysconfdir}/%{name}/bareos-dir.d/plugin-python-ldap.conf
937%endif
938
939%if ! 0%{?glusterfs}
940rm -f %{buildroot}/%{script_dir}/bareos-glusterfind-wrapper
941%endif
942
943# install tray monitor
944# #if 0#{?build_qt_monitor}
945# #if 0#{?suse_version} > 1010
946# disables, because suse_update_desktop_file complains
947# that there are two desktop file (applications and autostart)
948# ##suse_update_desktop_file bareos-tray-monitor System Backup
949# #endif
950# #endif
951
952
953# remove man page if qt tray monitor is not built
954%if !0%{?build_qt_monitor}
955rm %{buildroot}%{_mandir}/man1/bareos-tray-monitor.*
956%endif
957
958# install systemd service files
959%if 0%{?systemd_support}
960install -d -m 755 %{buildroot}%{_unitdir}
961install -m 644 platforms/systemd/bareos-dir.service %{buildroot}%{_unitdir}
962install -m 644 platforms/systemd/bareos-fd.service %{buildroot}%{_unitdir}
963install -m 644 platforms/systemd/bareos-sd.service %{buildroot}%{_unitdir}
964%if 0%{?suse_version}
965ln -sf service %{buildroot}%{_sbindir}/rcbareos-dir
966ln -sf service %{buildroot}%{_sbindir}/rcbareos-fd
967ln -sf service %{buildroot}%{_sbindir}/rcbareos-sd
968%endif
969%endif
970
971# Create the Readme files for the meta packages
972[ -d %{buildroot}%{_docdir}/%{name}/ ]  || install -d -m 755 %{buildroot}%{_docdir}/%{name}
973echo "This meta package emulates the former bareos-client package" > %{buildroot}%{_docdir}/%{name}/README.bareos-client
974echo "This is a meta package to install a full bareos system" > %{buildroot}%{_docdir}/%{name}/README.bareos
975
976%files
977%defattr(-, root, root)
978%{_docdir}/%{name}/README.bareos
979
980%files client
981%defattr(-, root, root)
982%dir %{_docdir}/%{name}
983%{_docdir}/%{name}/README.bareos-client
984
985
986%files bconsole
987# console package
988%defattr(-, root, root)
989%attr(0640, root, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bconsole.conf
990%{_bindir}/bconsole
991%{_sbindir}/bconsole
992%{_mandir}/man1/bconsole.1.gz
993
994%if !0%{?client_only}
995
996%files director
997# dir package (bareos-dir)
998%defattr(-, root, root)
999%if 0%{?suse_version}
1000%if !0%{?systemd_support}
1001%{_sysconfdir}/init.d/bareos-dir
1002%endif
1003%{_sbindir}/rcbareos-dir
1004%if 0%{?install_suse_fw}
1005# use noreplace if user has adjusted its list of IP
1006%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-dir
1007%endif
1008%else
1009%if !0%{?systemd_support}
1010%{_sysconfdir}/rc.d/init.d/bareos-dir
1011%endif
1012%endif
1013%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/catalog/MyCatalog.conf
1014%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/client/bareos-fd.conf
1015%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/console/bareos-mon.conf
1016%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/director/bareos-dir.conf
1017%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/Catalog.conf
1018%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/LinuxAll.conf
1019%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/SelfTest.conf
1020%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) "%{_sysconfdir}/%{name}/bareos-dir.d/fileset/Windows All Drives.conf"
1021%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/job/backup-bareos-fd.conf
1022%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/job/BackupCatalog.conf
1023%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/jobdefs/DefaultJob.conf
1024%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/job/RestoreFiles.conf
1025%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/messages/Daemon.conf
1026%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/messages/Standard.conf
1027%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/pool/Differential.conf
1028%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/pool/Full.conf
1029%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/pool/Incremental.conf
1030%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/pool/Scratch.conf
1031%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/profile/operator.conf
1032%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/schedule/WeeklyCycleAfterBackup.conf
1033%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/schedule/WeeklyCycle.conf
1034%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-dir.d/storage/File.conf
1035%attr(0750, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir-export/
1036%if 0%{?build_qt_monitor}
1037%attr(0755, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/tray-monitor.d/director
1038%attr(0644, %{daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/tray-monitor.d/director/Director-local.conf
1039%endif
1040%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-dir
1041# we do not have any dir plugin but the python plugin
1042#%%{plugin_dir}/*-dir.so
1043%{script_dir}/delete_catalog_backup
1044%{script_dir}/make_catalog_backup
1045%{script_dir}/make_catalog_backup.pl
1046%{_sbindir}/bareos-dir
1047%dir %{_docdir}/%{name}
1048%{_mandir}/man8/bareos-dir.8.gz
1049%{_mandir}/man8/bareos.8.gz
1050%if 0%{?systemd_support}
1051%{_unitdir}/bareos-dir.service
1052%endif
1053
1054# query.sql is not a config file,
1055# but can be personalized by end user.
1056# a rpmlint rule is add to filter the warning
1057%config(noreplace) %{script_dir}/query.sql
1058
1059%files storage
1060# sd package (bareos-sd, bls, btape, bcopy, bextract)
1061%defattr(-, root, root)
1062%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d
1063%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/autochanger
1064%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/device
1065%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/director
1066%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/ndmp
1067%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/messages
1068%attr(0750, %{storage_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-sd.d/storage
1069%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-sd.d/device/FileStorage.conf
1070%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-sd.d/director/bareos-dir.conf
1071%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-sd.d/director/bareos-mon.conf
1072%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-sd.d/messages/Standard.conf
1073%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-sd.d/storage/bareos-sd.conf
1074%if 0%{?build_qt_monitor}
1075%attr(0755, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/tray-monitor.d/storage
1076%attr(0644, %{daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/tray-monitor.d/storage/StorageDaemon-local.conf
1077%endif
1078%if 0%{?suse_version}
1079%if !0%{?systemd_support}
1080%{_sysconfdir}/init.d/bareos-sd
1081%endif
1082%{_sbindir}/rcbareos-sd
1083%if 0%{?install_suse_fw}
1084# use noreplace if user has adjusted its list of IP
1085%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-sd
1086%endif
1087%else
1088%if !0%{?systemd_support}
1089%{_sysconfdir}/rc.d/init.d/bareos-sd
1090%endif
1091%endif
1092%{_sbindir}/bareos-sd
1093%{script_dir}/disk-changer
1094%{plugin_dir}/autoxflate-sd.so
1095%{_mandir}/man8/bareos-sd.8.gz
1096%if 0%{?systemd_support}
1097%{_unitdir}/bareos-sd.service
1098%endif
1099%attr(0775, %{storage_daemon_user}, %{daemon_group}) %dir /var/lib/%{name}/storage
1100
1101%files storage-tape
1102# tape specific files
1103%defattr(-, root, root)
1104%{backend_dir}/libbareossd-gentape*.so
1105%{backend_dir}/libbareossd-tape*.so
1106%{script_dir}/mtx-changer
1107%config(noreplace) %{_sysconfdir}/%{name}/mtx-changer.conf
1108%{_mandir}/man8/bscrypto.8.gz
1109%{_mandir}/man8/btape.8.gz
1110%{_sbindir}/bscrypto
1111%{_sbindir}/btape
1112%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/Tape.conf.example
1113%attr(0640, %{storage_daemon_user},  %{daemon_group}) %{_sysconfdir}/%{name}/bareos-sd.d/autochanger/autochanger-0.conf.example
1114%attr(0640, %{storage_daemon_user},  %{daemon_group}) %{_sysconfdir}/%{name}/bareos-sd.d/device/tapedrive-0.conf.example
1115%{plugin_dir}/scsicrypto-sd.so
1116%{plugin_dir}/scsitapealert-sd.so
1117
1118%files storage-fifo
1119%defattr(-, root, root)
1120%{backend_dir}/libbareossd-fifo*.so
1121%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/NULL.conf.example
1122%attr(0640, %{storage_daemon_user}, %{daemon_group})  %{_sysconfdir}/%{name}/bareos-sd.d/device/NULL.conf.example
1123
1124%if 0%{?droplet}
1125%files storage-droplet
1126%defattr(-, root, root)
1127%{backend_dir}/libbareossd-chunked*.so
1128%{backend_dir}/libbareossd-droplet*.so
1129%attr(0640, %{director_daemon_user},%{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/S3_Object.conf.example
1130%attr(0640, %{storage_daemon_user},%{daemon_group})  %{_sysconfdir}/%{name}/bareos-sd.d/device/S3_ObjectStorage.conf.example
1131%dir %{_sysconfdir}/%{name}/bareos-sd.d/device/droplet/
1132%attr(0640, %{storage_daemon_user},%{daemon_group})  %{_sysconfdir}/%{name}/bareos-sd.d/device/droplet/*.example
1133%endif
1134
1135%if 0%{?glusterfs}
1136%files storage-glusterfs
1137%defattr(-, root, root)
1138%{backend_dir}/libbareossd-gfapi*.so
1139%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/Gluster.conf.example
1140%attr(0640, %{storage_daemon_user}, %{daemon_group})  %{_sysconfdir}/%{name}/bareos-sd.d/device/GlusterStorage.conf.example
1141%endif
1142
1143%if 0%{?ceph}
1144%files storage-ceph
1145%defattr(-, root, root)
1146%{backend_dir}/libbareossd-rados*.so
1147%{backend_dir}/libbareossd-cephfs*.so
1148%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/Rados.conf.example
1149%attr(0640, %{storage_daemon_user}, %{daemon_group})  %{_sysconfdir}/%{name}/bareos-sd.d/device/RadosStorage.conf.example
1150%endif
1151
1152%endif # not client_only
1153
1154%files filedaemon
1155# fd package (bareos-fd, plugins)
1156%defattr(-, root, root)
1157%attr(0750, %{file_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-fd.d/
1158%attr(0750, %{file_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-fd.d/client
1159%attr(0750, %{file_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-fd.d/director
1160%attr(0750, %{file_daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-fd.d/messages
1161%attr(0640, %{file_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-fd.d/client/myself.conf
1162%attr(0640, %{file_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-fd.d/director/bareos-dir.conf
1163%attr(0640, %{file_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-fd.d/director/bareos-mon.conf
1164%attr(0640, %{file_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-fd.d/messages/Standard.conf
1165%if 0%{?build_qt_monitor}
1166%attr(0755, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/tray-monitor.d/client
1167%attr(0644, %{daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/tray-monitor.d/client/FileDaemon-local.conf
1168%endif
1169%if 0%{?suse_version}
1170%if !0%{?systemd_support}
1171%{_sysconfdir}/init.d/bareos-fd
1172%endif
1173%{_sbindir}/rcbareos-fd
1174%if 0%{?install_suse_fw}
1175# use noreplace if user has adjusted its list of IP
1176%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-fd
1177%endif
1178%else
1179%if !0%{?systemd_support}
1180%{_sysconfdir}/rc.d/init.d/bareos-fd
1181%endif
1182%endif
1183%{_sbindir}/bareos-fd
1184%{plugin_dir}/bpipe-fd.so
1185%{_mandir}/man8/bareos-fd.8.gz
1186# tray monitor
1187%if 0%{?systemd_support}
1188%{_unitdir}/bareos-fd.service
1189%endif
1190
1191%files common
1192# common shared libraries (without db)
1193%defattr(-, root, root)
1194%attr(0755, root, %{daemon_group})           %dir %{_sysconfdir}/%{name}
1195%if !0%{?client_only}
1196# these directories belong to bareos-common,
1197# as other packages may contain configurations for the director.
1198%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d
1199%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/catalog
1200%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/client
1201%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/console
1202%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/counter
1203%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/director
1204%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/fileset
1205%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/job
1206%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/jobdefs
1207%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/messages
1208%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/pool
1209%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/profile
1210%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/schedule
1211%attr(0750, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/bareos-dir.d/storage
1212# tray monitor configurate is installed by the target daemons
1213%if 0%{?build_qt_monitor}
1214%attr(0755, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/tray-monitor.d
1215%endif
1216%endif
1217%dir %{backend_dir}
1218%{library_dir}/libbareos.so*
1219%{library_dir}/libbareosfind.so*
1220%{library_dir}/libbareoslmdb.so*
1221%if !0%{?client_only}
1222%{library_dir}/libbareosndmp.so*
1223%{library_dir}/libbareossd.so*
1224%endif
1225# generic stuff needed from multiple bareos packages
1226%dir /usr/lib/%{name}/
1227%dir %{script_dir}
1228%{script_dir}/bareos-config
1229%{script_dir}/bareos-config-lib.sh
1230%{script_dir}/bareos-explorer
1231%{script_dir}/btraceback.gdb
1232%if "%{_libdir}" != "/usr/lib/"
1233%dir %{_libdir}/%{name}/
1234%endif
1235%dir %{plugin_dir}
1236%if !0%{?client_only}
1237%{_bindir}/bsmtp
1238%{_sbindir}/bsmtp
1239%endif
1240%{_sbindir}/btraceback
1241%if !0%{?client_only}
1242%{_mandir}/man1/bsmtp.1.gz
1243%endif
1244%{_mandir}/man8/btraceback.8.gz
1245%attr(0770, %{daemon_user}, %{daemon_group}) %dir %{working_dir}
1246%attr(0775, %{daemon_user}, %{daemon_group}) %dir /var/log/%{name}
1247%doc AGPL-3.0.txt LICENSE README.*
1248#TODO: cmake does not create build directory
1249#doc build/
1250
1251%if !0%{?client_only}
1252
1253%files database-common
1254# catalog independent files
1255%defattr(-, root, root)
1256%{library_dir}/libbareossql*.so.*
1257%{library_dir}/libbareoscats*.so.*
1258%dir %{script_dir}/ddl
1259%dir %{script_dir}/ddl/creates
1260%dir %{script_dir}/ddl/drops
1261%dir %{script_dir}/ddl/grants
1262%dir %{script_dir}/ddl/updates
1263%{script_dir}/create_bareos_database
1264%{script_dir}/drop_bareos_database
1265%{script_dir}/drop_bareos_tables
1266%{script_dir}/grant_bareos_privileges
1267%{script_dir}/make_bareos_tables
1268%{script_dir}/update_bareos_tables
1269%{script_dir}/ddl/versions.map
1270
1271%files database-postgresql
1272# postgresql catalog files
1273%defattr(-, root, root)
1274%{script_dir}/ddl/*/postgresql*.sql
1275%{backend_dir}/libbareoscats-postgresql.so*
1276
1277%files database-mysql
1278# mysql catalog files
1279%defattr(-, root, root)
1280%{script_dir}/ddl/*/mysql*.sql
1281%{backend_dir}/libbareoscats-mysql.so*
1282
1283%if 0%{?build_sqlite3}
1284%files database-sqlite3
1285# sqlite3 catalog files
1286%defattr(-, root, root)
1287%{script_dir}/ddl/*/sqlite3*.sql
1288%{backend_dir}/libbareoscats-sqlite3.so*
1289%endif
1290
1291%files database-tools
1292# dbtools with link to db libs (dbcheck, bscan)
1293%defattr(-, root, root)
1294%{_sbindir}/bareos-dbcheck
1295%{_sbindir}/bscan
1296%{_mandir}/man8/bareos-dbcheck.8.gz
1297%{_mandir}/man8/bscan.8.gz
1298
1299%files tools
1300# tools without link to db libs (bwild, bregex)
1301%defattr(-, root, root)
1302%{_bindir}/bregex
1303%{_bindir}/bwild
1304%{_sbindir}/bcopy
1305%{_sbindir}/bextract
1306%{_sbindir}/bls
1307%{_sbindir}/bregex
1308%{_sbindir}/bwild
1309%{_sbindir}/bpluginfo
1310%{_mandir}/man1/bwild.1.gz
1311%{_mandir}/man1/bregex.1.gz
1312%{_mandir}/man8/bcopy.8.gz
1313%{_mandir}/man8/bextract.8.gz
1314%{_mandir}/man8/bls.8.gz
1315%{_mandir}/man8/bpluginfo.8.gz
1316
1317%if 0%{?build_qt_monitor}
1318%files traymonitor
1319%defattr(-,root, root)
1320%attr(0755, %{daemon_user}, %{daemon_group}) %dir %{_sysconfdir}/%{name}/tray-monitor.d/monitor
1321%attr(0644, %{daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/tray-monitor.d/monitor/bareos-mon.conf
1322%config %{_sysconfdir}/xdg/autostart/bareos-tray-monitor.desktop
1323%{_bindir}/bareos-tray-monitor
1324%{_mandir}/man1/bareos-tray-monitor.1.gz
1325/usr/share/applications/bareos-tray-monitor.desktop
1326/usr/share/pixmaps/bareos-tray-monitor.xpm
1327%endif
1328
1329
1330%endif # client_only
1331
1332%files devel
1333%defattr(-, root, root)
1334/usr/include/%{name}
1335
1336%if 0%{?python_plugins}
1337%files filedaemon-python-plugin
1338%defattr(-, root, root)
1339%{plugin_dir}/python-fd.so
1340%{plugin_dir}/bareos-fd.py*
1341%{plugin_dir}/bareos-fd-local-fileset.py*
1342%{plugin_dir}/bareos-fd-mock-test.py*
1343%{plugin_dir}/BareosFdPluginBaseclass.py*
1344%{plugin_dir}/BareosFdPluginLocalFileset.py*
1345%{plugin_dir}/BareosFdWrapper.py*
1346%{plugin_dir}/bareos_fd_consts.py*
1347
1348%files filedaemon-ldap-python-plugin
1349%defattr(-, root, root)
1350%{plugin_dir}/bareos-fd-ldap.py*
1351%{plugin_dir}/BareosFdPluginLDAP.py*
1352%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-ldap.conf.example
1353%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/backup-ldap.conf.example
1354%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/restore-ldap.conf.example
1355
1356%files director-python-plugin
1357%defattr(-, root, root)
1358%{plugin_dir}/python-dir.so
1359%{plugin_dir}/bareos-dir.py*
1360%{plugin_dir}/bareos_dir_consts.py*
1361%{plugin_dir}/BareosDirPluginBaseclass.py*
1362%{plugin_dir}/bareos-dir-class-plugin.py*
1363%{plugin_dir}/BareosDirWrapper.py*
1364
1365%files storage-python-plugin
1366%defattr(-, root, root)
1367%{plugin_dir}/python-sd.so
1368%{plugin_dir}/bareos-sd.py*
1369%{plugin_dir}/bareos_sd_consts.py*
1370%{plugin_dir}/BareosSdPluginBaseclass.py*
1371%{plugin_dir}/BareosSdWrapper.py*
1372%{plugin_dir}/bareos-sd-class-plugin.py*
1373
1374%endif # python_plugins
1375
1376%if 0%{?glusterfs}
1377%files filedaemon-glusterfs-plugin
1378%{script_dir}/bareos-glusterfind-wrapper
1379%{plugin_dir}/gfapi-fd.so
1380%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-gfapi.conf.example
1381%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/BackupGFAPI.conf.example
1382%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/RestoreGFAPI.conf.example
1383%endif
1384
1385%if 0%{?ceph}
1386%files filedaemon-ceph-plugin
1387%{plugin_dir}/cephfs-fd.so
1388%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-cephfs.conf.example
1389%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/BackupCephfs.conf.example
1390%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/RestoreCephfs.conf.example
1391%{plugin_dir}/rados-fd.so
1392%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-rados.conf.example
1393%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/BackupRados.conf.example
1394%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/RestoreRados.conf.example
1395%endif
1396
1397%files regress-config
1398%defattr(-, root, root)
1399%{script_dir}/%{name}
1400%{script_dir}/bareos-ctl-*
1401%{_bindir}/timelimit
1402%{_sbindir}/timelimit
1403%{_sbindir}/btestls
1404# must be readable by package build user of bareos-regress.
1405%attr(0644, %{daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/%{name}/bareos-regress.conf
1406
1407
1408#
1409# Define some macros for updating the system settings.
1410#
1411%if 0%{?RHEL4}
1412%define add_service_start() ( /sbin/chkconfig --add %1; %nil)
1413%define stop_on_removal() ( /sbin/service %1 stop >/dev/null 2>&1 ||  /sbin/chkconfig --del %1 || true; %nil)
1414%define restart_on_update() (/sbin/service %1 condrestart >/dev/null 2>&1 || true; %nil)
1415%define insserv_cleanup() (/bin/true; %nil)
1416%define create_group() (getent group %1 > /dev/null || groupadd -r %1; %nil);
1417%define create_user() ( getent passwd %1 > /dev/null || useradd -r -c "%1" -d %{working_dir} -g %{daemon_group} -s /bin/false %1; %nil);
1418%else
1419# non RHEL4
1420%if 0%{?suse_version}
1421
1422%if 0%{?systemd_support}
1423%define insserv_cleanup() (/bin/true; %nil)
1424%else
1425%if 0%{!?add_service_start:1}
1426%define add_service_start() \
1427SERVICE=%1 \
1428#service_add $1 \
1429%fillup_and_insserv $SERVICE \
1430%nil
1431%endif
1432%endif
1433
1434%else
1435# non suse, systemd
1436
1437%define insserv_cleanup() \
1438/bin/true \
1439%nil
1440
1441%if 0%{?systemd_support}
1442# non suse, systemd
1443
1444%define add_service_start() \
1445/bin/systemctl daemon-reload >/dev/null 2>&1 || true \
1446/bin/systemctl enable %1.service >/dev/null 2>&1 || true \
1447%nil
1448
1449%define stop_on_removal() \
1450test -n "$FIRST_ARG" || FIRST_ARG=$1 \
1451if test "$FIRST_ARG" = "0" ; then \
1452  /bin/systemctl stop %1.service > /dev/null 2>&1 || true \
1453fi \
1454%nil
1455
1456%define restart_on_update() \
1457test -n "$FIRST_ARG" || FIRST_ARG=$1 \
1458if test "$FIRST_ARG" -ge 1 ; then \
1459  /bin/systemctl try-restart %1.service >/dev/null 2>&1 || true \
1460fi \
1461%nil
1462
1463%else
1464# non suse, init.d
1465
1466%define add_service_start() \
1467/sbin/chkconfig --add %1 \
1468%nil
1469
1470%define stop_on_removal() \
1471test -n "$FIRST_ARG" || FIRST_ARG=$1 \
1472if test "$FIRST_ARG" = "0" ; then \
1473  /sbin/service %1 stop >/dev/null 2>&1 || \
1474  /sbin/chkconfig --del %1 || true \
1475fi \
1476%nil
1477
1478%define restart_on_update() \
1479test -n "$FIRST_ARG" || FIRST_ARG=$1 \
1480if test "$FIRST_ARG" -ge 1 ; then \
1481  /sbin/service %1 condrestart >/dev/null 2>&1 || true \
1482fi \
1483%nil
1484
1485%endif
1486
1487%endif
1488
1489%define create_group() \
1490getent group %1 > /dev/null || groupadd -r %1 \
1491%nil
1492
1493# shell: use /bin/false, because nologin has different paths on different distributions
1494%define create_user() \
1495getent passwd %1 > /dev/null || useradd -r --comment "%1" --home %{working_dir} -g %{daemon_group} --shell /bin/false %1 \
1496%nil
1497
1498%endif
1499
1500# With the introduction of config subdirectories (bareos-16.2)
1501# some config files have been renamed (or even splitted into multiple files).
1502# However, bareos is still able to work with the old config files,
1503# but rpm renames them to *.rpmsave.
1504# To keep the bareos working after updating to bareos-16.2,
1505# we implement a workaroung:
1506#   * post: if the old config exists, make a copy of it.
1507#   * (rpm exchanges files on disk)
1508#   * posttrans:
1509#       if the old config file don't exists but we have created a backup before,
1510#       restore the old config file.
1511#       Remove our backup, if it exists.
1512# This update helper should be removed with bareos-17.
1513
1514%define post_backup_file() \
1515if [ -f  %1 ]; then \
1516      cp -a %1 %1.rpmupdate.%{version}.keep; \
1517fi; \
1518%nil
1519
1520%define posttrans_restore_file() \
1521if [ ! -e %1 -a -e %1.rpmupdate.%{version}.keep ]; then \
1522   mv %1.rpmupdate.%{version}.keep %1; \
1523fi; \
1524if [ -e %1.rpmupdate.%{version}.keep ]; then \
1525   rm %1.rpmupdate.%{version}.keep; \
1526fi; \
1527%nil
1528
1529
1530%post director
1531%post_backup_file /etc/%{name}/bareos-dir.conf
1532%{script_dir}/bareos-config initialize_local_hostname
1533%{script_dir}/bareos-config initialize_passwords
1534%{script_dir}/bareos-config initialize_database_driver
1535%if 0%{?suse_version} >= 1210
1536%service_add_post bareos-dir.service
1537/bin/systemctl enable bareos-dir.service >/dev/null 2>&1 || true
1538%else
1539%add_service_start bareos-dir
1540%endif
1541
1542%posttrans director
1543%posttrans_restore_file /etc/%{name}/bareos-dir.conf
1544
1545%post storage
1546%post_backup_file /etc/%{name}/bareos-sd.conf
1547# pre script has already generated the storage daemon user,
1548# but here we add the user to additional groups
1549%{script_dir}/bareos-config setup_sd_user
1550%{script_dir}/bareos-config initialize_local_hostname
1551%{script_dir}/bareos-config initialize_passwords
1552%if 0%{?suse_version} >= 1210
1553%service_add_post bareos-sd.service
1554/bin/systemctl enable bareos-sd.service >/dev/null 2>&1 || true
1555%else
1556%add_service_start bareos-sd
1557%endif
1558
1559%posttrans storage
1560%posttrans_restore_file /etc/%{name}/bareos-sd.conf
1561
1562
1563%if 0%{?ceph}
1564%post storage-ceph
1565%post_backup_file /etc/%{name}/bareos-sd.d/device-ceph-rados.conf
1566
1567%posttrans storage-ceph
1568%posttrans_restore_file /etc/%{name}/bareos-sd.d/device-ceph-rados.conf
1569%endif
1570
1571
1572%post storage-fifo
1573%post_backup_file /etc/%{name}/bareos-sd.d/device-fifo.conf
1574
1575%posttrans storage-fifo
1576%posttrans_restore_file /etc/%{name}/bareos-sd.d/device-fifo.conf
1577
1578
1579%post storage-tape
1580%post_backup_file /etc/%{name}/bareos-sd.d/device-tape-with-autoloader.conf
1581
1582%posttrans storage-tape
1583%posttrans_restore_file /etc/%{name}/bareos-sd.d/device-tape-with-autoloader.conf
1584
1585
1586%post filedaemon
1587%post_backup_file /etc/%{name}/bareos-fd.conf
1588%{script_dir}/bareos-config initialize_local_hostname
1589%{script_dir}/bareos-config initialize_passwords
1590%if 0%{?suse_version} >= 1210
1591%service_add_post bareos-fd.service
1592/bin/systemctl enable bareos-fd.service >/dev/null 2>&1 || true
1593%else
1594%add_service_start bareos-fd
1595%endif
1596
1597%posttrans filedaemon
1598%posttrans_restore_file /etc/%{name}/bareos-fd.conf
1599
1600
1601%if 0%{?ceph}
1602%post filedaemon-ceph-plugin
1603%post_backup_file /etc/%{name}/bareos-dir.d/plugin-cephfs.conf
1604%post_backup_file /etc/%{name}/bareos-dir.d/plugin-rados.conf
1605
1606%posttrans filedaemon-ceph-plugin
1607%posttrans_restore_file /etc/%{name}/bareos-dir.d/plugin-cephfs.conf
1608%posttrans_restore_file /etc/%{name}/bareos-dir.d/plugin-rados.conf
1609%endif
1610
1611
1612%if 0%{?python_plugins}
1613%post filedaemon-ldap-python-plugin
1614%post_backup_file /etc/%{name}/bareos-dir.d/plugin-python-ldap.conf
1615
1616%posttrans filedaemon-ldap-python-plugin
1617%posttrans_restore_file /etc/%{name}/bareos-dir.d/plugin-python-ldap.conf
1618%endif
1619
1620
1621%post bconsole
1622%{script_dir}/bareos-config initialize_local_hostname
1623%{script_dir}/bareos-config initialize_passwords
1624
1625%post common
1626/sbin/ldconfig
1627
1628%postun common
1629/sbin/ldconfig
1630
1631%post database-common
1632/sbin/ldconfig
1633
1634%postun database-common
1635/sbin/ldconfig
1636
1637%post database-postgresql
1638/sbin/ldconfig
1639
1640%postun database-postgresql
1641/sbin/ldconfig
1642
1643%post database-mysql
1644/sbin/ldconfig
1645
1646%postun database-mysql
1647/sbin/ldconfig
1648
1649%if 0%{?build_sqlite3}
1650%post database-sqlite3
1651/sbin/ldconfig
1652
1653%postun database-sqlite3
1654/sbin/ldconfig
1655%endif
1656
1657
1658%if 0%{?build_qt_monitor}
1659
1660%post traymonitor
1661%post_backup_file /etc/%{name}/tray-monitor.conf
1662%{script_dir}/bareos-config initialize_local_hostname
1663%{script_dir}/bareos-config initialize_passwords
1664
1665%posttrans traymonitor
1666%posttrans_restore_file /etc/%{name}/tray-monitor.conf
1667
1668%endif
1669
1670
1671%pre director
1672%create_group %{daemon_group}
1673%create_user  %{director_daemon_user}
1674exit 0
1675
1676%pre storage
1677%create_group %{daemon_group}
1678%create_user  %{storage_daemon_user}
1679exit 0
1680
1681%pre filedaemon
1682%create_group %{daemon_group}
1683%create_user  %{storage_daemon_user}
1684exit 0
1685
1686%pre common
1687%create_group %{daemon_group}
1688%create_user  %{daemon_user}
1689exit 0
1690
1691%preun director
1692%if 0%{?suse_version} >= 1210
1693%service_del_preun bareos-dir.service
1694%else
1695%stop_on_removal bareos-dir
1696%endif
1697
1698%preun storage
1699%if 0%{?suse_version} >= 1210
1700%service_del_preun bareos-sd.service
1701%else
1702%stop_on_removal bareos-sd
1703%endif
1704
1705%preun filedaemon
1706%if 0%{?suse_version} >= 1210
1707%service_del_preun bareos-fd.service
1708%else
1709%stop_on_removal bareos-fd
1710%endif
1711
1712%postun director
1713# to prevent aborting jobs, no restart on update
1714%insserv_cleanup
1715
1716%postun storage
1717# to prevent aborting jobs, no restart on update
1718%insserv_cleanup
1719
1720%postun filedaemon
1721%if 0%{?suse_version} >= 1210
1722%service_del_postun bareos-fd.service
1723%else
1724%restart_on_update bareos-fd
1725%endif
1726%insserv_cleanup
1727
1728%changelog
1729