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