-
Notifications
You must be signed in to change notification settings - Fork 256
/
bareos.spec
1788 lines (1502 loc) · 53.3 KB
/
bareos.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# spec file for package bareos
# Copyright (c) 2011-2012 Bruno Friedmann (Ioda-Net) and Philipp Storz (dass IT)
# 2013-2018 Bareos GmbH & Co KG
#
Name: bareos
Version: 0.0.0
Release: 0
Group: Productivity/Archiving/Backup
License: AGPL-3.0
BuildRoot: %{_tmppath}/%{name}-root
URL: http://www.bareos.org/
Vendor: The Bareos Team
#Packager: {_packager}
%define library_dir %{_libdir}/%{name}
%define backend_dir %{_libdir}/%{name}/backends
%define plugin_dir %{_libdir}/%{name}/plugins
%define script_dir /usr/lib/%{name}/scripts
%define working_dir /var/lib/%{name}
%define pid_dir /var/lib/%{name}
%define bsr_dir /var/lib/%{name}
# TODO: use /run ?
%define _subsysdir /var/lock
#
# Generic daemon user and group
#
%define daemon_user bareos
%define daemon_group bareos
%define director_daemon_user %{daemon_user}
%define storage_daemon_user %{daemon_user}
%define file_daemon_user root
%define storage_daemon_group %{daemon_group}
# default settings
%define client_only 0
%define build_qt_monitor 1
%define build_sqlite3 1
%define glusterfs 0
%define droplet 0
%define have_git 1
%define ceph 0
%define install_suse_fw 0
%define systemd_support 0
%define python_plugins 1
# cmake build directory
%define CMAKE_BUILDDIR cmake-build
# fedora 28 deprecated libwrap
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
%define use_libwrap 0
%else
%define use_libwrap 1
%endif
# rhel/centos 6 must not be built with libtirpc installed
%if 0%{?rhel} == 6
BuildConflicts: libtirpc-devel
%endif
# fedora 28: rpc was removed from libc
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
BuildRequires: rpcgen
BuildRequires: libtirpc-devel
%endif
#
# SUSE (openSUSE, SLES) specific settigs
#
%if 0%{?sles_version} == 10
%define build_qt_monitor 0
%define build_sqlite3 0
%define have_git 0
%define python_plugins 0
%endif
%if 0%{?suse_version} > 1010
%define install_suse_fw 1
%define _fwdefdir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%endif
%if 0%{?suse_version} > 1140
%define systemd_support 1
%endif
# SLE 12
# SLE_15: droplet is not available due to SSL build problems
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} < 150000
%define droplet 1
%endif
%if 0%{?sle_version} >= 120000
%define ceph 1
%endif
#
# RedHat (CentOS, Fedora, RHEL) specific settings
#
%if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500
%define RHEL4 1
%define client_only 1
%define build_qt_monitor 0
%define build_sqlite3 0
%define have_git 0
%define python_plugins 0
%endif
# centos/rhel 5: segfault when building qt monitor
%if 0%{?centos_version} == 505 || 0%{?rhel_version} == 505
%define build_qt_monitor 0
%define have_git 0
%define python_plugins 0
%endif
%if 0%{?fedora_version} >= 20
%define glusterfs 1
%define systemd_support 1
%endif
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
%define glusterfs 1
%define droplet 1
%define systemd_support 1
%endif
%if 0%{?rhel_version} == 800
%define droplet 0
%endif
%if 0%{?rhel_version} >= 700 && !0%{?centos_version}
%define ceph 1
%endif
%if 0%{?centos} >= 8
%define ceph 1
%endif
# use Developer Toolset 7 compiler as standard is too old
%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
BuildRequires: devtoolset-7-gcc
BuildRequires: devtoolset-7-gcc-c++
%endif
%if 0%{?systemd_support}
BuildRequires: systemd
# see https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
%endif
%{?systemd_requires}
%endif
%if 0%{?droplet}
BuildRequires: libdroplet-devel
%endif
%if 0%{?glusterfs}
BuildRequires: glusterfs-devel glusterfs-api-devel
%endif
%if 0%{?ceph}
%if 0%{?sle_version} >= 120200
BuildRequires: libcephfs-devel
BuildRequires: librados-devel
%else
# the rhel macro is set in docker, but not in obs
%if 0%{?rhel} == 7
BuildRequires: librados2-devel
BuildRequires: libcephfs1-devel
%else
%if 0%{?rhel} == 8
BuildRequires: librados-devel
BuildRequires: libradosstriper-devel
BuildRequires: libcephfs-devel
%else
BuildRequires: ceph-devel
%endif
%endif
%endif
%endif
%if 0%{?have_git}
BuildRequires: git-core
%endif
Source0: %{name}-%{version}.tar.bz2
BuildRequires: pam-devel
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: glibc
BuildRequires: glibc-devel
BuildRequires: ncurses-devel
BuildRequires: perl
BuildRequires: readline-devel
BuildRequires: libstdc++-devel
BuildRequires: zlib-devel
BuildRequires: openssl-devel
BuildRequires: libacl-devel
BuildRequires: pkgconfig
BuildRequires: lzo-devel
BuildRequires: logrotate
%if 0%{?build_sqlite3}
%if 0%{?suse_version}
BuildRequires: sqlite3-devel
%else
BuildRequires: sqlite-devel
%endif
%endif
BuildRequires: mysql-devel
BuildRequires: postgresql-devel
BuildRequires: openssl
BuildRequires: libcap-devel
BuildRequires: mtx
%if 0%{?build_qt_monitor}
%if 0%{?suse_version}
BuildRequires: libqt5-qtbase-devel
%else
%if 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?fedora} >= 29
BuildRequires: qt5-qtbase-devel
%else
BuildRequires: qt-devel
%endif
%endif
%endif
%if 0%{?python_plugins}
%if 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?fedora} >= 31
BuildRequires: python2-devel >= 2.6
%else
BuildRequires: python-devel >= 2.6
%endif
%endif
%if 0%{?suse_version}
# suse_version:
# 1315: SLE_12
# 1110: SLE_11
# 1010: SLE_10
BuildRequires: distribution-release
BuildRequires: pwdutils
BuildRequires: tcpd-devel
BuildRequires: termcap
BuildRequires: update-desktop-files
%if 0%{?suse_version} > 1010
# link identical files
BuildRequires: fdupes
BuildRequires: libjansson-devel
BuildRequires: lsb-release
%endif
%else
# non suse
BuildRequires: libtermcap-devel
BuildRequires: passwd
%if %{use_libwrap}
BuildRequires: tcp_wrappers
%endif
# Some magic to be able to determine what platform we are running on.
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
BuildRequires: redhat-lsb
# older versions require additional release packages
%if 0%{?rhel_version} && 0%{?rhel_version} <= 600
BuildRequires: redhat-release
%endif
%if 0%{?centos_version} && 0%{?centos_version} <= 600
BuildRequires: redhat-release
%endif
%if 0%{?fedora_version}
BuildRequires: fedora-release
%endif
%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version} >= 14
BuildRequires: jansson-devel
%if %{use_libwrap}
BuildRequires: tcp_wrappers-devel
%endif
%endif
%else
# non suse, non redhat: eg. mandriva.
BuildRequires: lsb-release
%endif
%endif
Summary: Backup Archiving REcovery Open Sourced - metapackage
Requires: %{name}-director = %{version}
Requires: %{name}-storage = %{version}
Requires: %{name}-client = %{version}
%if 0%{?RHEL4}
%define dscr Bareos - Backup Archiving Recovery Open Sourced.
%else
%define dscr Bareos - Backup Archiving Recovery Open Sourced. \
Bareos is a set of computer programs that permit you (or the system \
administrator) to manage backup, recovery, and verification of computer \
data across a network of computers of different kinds. In technical terms, \
it is a network client/server based backup program. Bareos is relatively \
easy to use and efficient, while offering many advanced storage management \
features that make it easy to find and recover lost or damaged files. \
Bareos source code has been released under the AGPL version 3 license.
%endif
%description
%{dscr}
%if 0%{?opensuse_version} || 0%{?sle_version}
%debug_package
%endif
# Notice : Don't try to change the order of package declaration
# You will have side effect with PreReq
%package bconsole
Summary: Bareos administration console (CLI)
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
%package client
Summary: Bareos client Meta-All-In-One package
Group: Productivity/Archiving/Backup
Requires: %{name}-bconsole = %{version}
Requires: %{name}-filedaemon = %{version}
%if 0%{?suse_version}
Recommends: %{name}-traymonitor = %{version}
%endif
%package director
Summary: Bareos Director daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-database-common = %{version}
Requires: %{name}-database-tools
%if 0%{?suse_version}
Requires(pre): pwdutils
# Don't use this option on anything other then SUSE derived distributions
# as Fedora & others don't know this tag
Recommends: logrotate
%else
Requires(pre): shadow-utils
%endif
Provides: %{name}-dir
%package storage
Summary: Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Provides: %{name}-sd
%if 0%{?suse_version}
Requires(pre): pwdutils
Recommends: bareos-tools
%else
Requires(pre): shadow-utils
# Recommends would be enough, however only supported by Fedora >= 24.
Requires: bareos-tools
%endif
%if 0%{?droplet}
%package storage-droplet
Summary: Object Storage support (through libdroplet) for the Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-storage = %{version}
%endif
%if 0%{?glusterfs}
%package storage-glusterfs
Summary: GlusterFS support for the Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-storage = %{version}
Requires: glusterfs
%endif
%if 0%{?ceph}
%package storage-ceph
Summary: CEPH support for the Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-storage = %{version}
%endif
%package storage-tape
Summary: Tape support for the Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-storage = %{version}
Requires: mtx
%if !0%{?suse_version}
Requires: mt-st
%endif
%package storage-fifo
Summary: FIFO support for the Bareos Storage backend
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-storage = %{version}
%package filedaemon
Summary: Bareos File daemon (backup and restore client)
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Provides: %{name}-fd
%if 0%{?suse_version}
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
%package common
Summary: Common files, required by multiple Bareos packages
Group: Productivity/Archiving/Backup
Requires: openssl
%if 0%{?suse_version}
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
Provides: %{name}-libs
%package database-common
Summary: Generic abstraction libs and files to connect to a database
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-database-backend = %{version}
Requires: openssl
Provides: %{name}-sql
%package database-postgresql
Summary: Libs & tools for postgresql catalog
Group: Productivity/Archiving/Backup
Requires: %{name}-database-common = %{version}
Provides: %{name}-catalog-postgresql
Provides: %{name}-database-backend
%package database-mysql
Summary: Libs & tools for mysql catalog
Group: Productivity/Archiving/Backup
Requires: %{name}-database-common = %{version}
Provides: %{name}-catalog-mysql
Provides: %{name}-database-backend
%if 0%{?build_sqlite3}
%package database-sqlite3
Summary: Libs & tools for sqlite3 catalog
Group: Productivity/Archiving/Backup
%if 0%{?suse_version}
Requires: sqlite3
%endif
%if 0%{?fedora_version}
Requires: sqlite
%endif
Requires: %{name}-database-common = %{version}
Provides: %{name}-catalog-sqlite3
Provides: %{name}-database-backend
%endif
%package database-tools
Summary: Bareos CLI tools with database dependencies (bareos-dbcheck, bscan)
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-database-common = %{version}
Provides: %{name}-dbtools
%package tools
Summary: Bareos CLI tools (bcopy, bextract, bls, bregex, bwild)
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
%if 0%{build_qt_monitor}
%package traymonitor
Summary: Bareos Tray Monitor (QT)
Group: Productivity/Archiving/Backup
# Added to by pass the 09 checker rules (conflict with bareos-tray-monitor.conf)
# This is mostly wrong cause the two binaries can use it!
Conflicts: %{name}-tray-monitor-gtk
Provides: %{name}-tray-monitor-qt
%endif
%package devel
Summary: Devel headers
Group: Development/Languages/C and C++
Requires: %{name}-common = %{version}
Requires: zlib-devel
Requires: libacl-devel
Requires: postgresql-devel
Requires: libcap-devel
%if 0%{?build_sqlite3}
%if 0%{?suse_version}
Requires: sqlite3-devel
%else
Requires: sqlite-devel
%endif
%endif
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
Requires: openssl-devel
%else
Requires: libopenssl-devel
%endif
%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version}
%if %{use_libwrap}
Requires: tcp_wrappers-devel
%endif
%else
%if 0%{?rhel_version} || 0%{?centos_version}
%if %{use_libwrap}
Requires: tcp_wrappers
%endif
%else
Requires: tcpd-devel
%endif
%endif
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700 || 0%{?fedora_version} >= 19
Requires: mariadb-devel
%else
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
Requires: mysql-devel
%else
Requires: libmysqlclient-devel
%endif
%endif
%package regress-config
Summary: Required files for bareos-regress
Group: Development/Languages/C and C++
Requires: %{name}-common = %{version}
%if 0%{?python_plugins}
%package director-python-plugin
Summary: Python plugin for Bareos Director daemon
Group: Productivity/Archiving/Backup
Requires: bareos-director = %{version}
%package filedaemon-python-plugin
Summary: Python plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
%package filedaemon-ldap-python-plugin
Summary: LDAP Python plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
Requires: bareos-filedaemon-python-plugin = %{version}
Requires: python-ldap
%package filedaemon-ovirt-python-plugin
Summary: Ovirt Python plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
Requires: bareos-filedaemon-python-plugin = %{version}
Requires: python-pycurl
Requires: python-lxml
Requires: python-ovirt-engine-sdk4
%package filedaemon-percona-xtrabackup-python-plugin
Summary: LDAP Python plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
Requires: bareos-filedaemon-python-plugin = %{version}
#Requires: python-percona
%package storage-python-plugin
Summary: Python plugin for Bareos Storage daemon
Group: Productivity/Archiving/Backup
Requires: bareos-storage = %{version}
%description director-python-plugin
%{dscr}
This package contains the python plugin for the director daemon
%description filedaemon-python-plugin
%{dscr}
This package contains the python plugin for the file daemon
%description filedaemon-ldap-python-plugin
%{dscr}
This package contains the LDAP python plugin for the file daemon
%description filedaemon-ovirt-python-plugin
%{dscr}
This package contains the Ovirt python plugin for the file daemon
%description filedaemon-percona-xtrabackup-python-plugin
%{dscr}
This package contains the Percona python plugin for the file daemon
%description storage-python-plugin
%{dscr}
This package contains the python plugin for the storage daemon
%endif
%if 0%{?glusterfs}
%package filedaemon-glusterfs-plugin
Summary: GlusterFS plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
Requires: glusterfs
%description filedaemon-glusterfs-plugin
%{dscr}
This package contains the GlusterFS plugin for the file daemon
%endif
%if 0%{?ceph}
%package filedaemon-ceph-plugin
Summary: CEPH plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
%description filedaemon-ceph-plugin
%{dscr}
This package contains the CEPH plugins for the file daemon
%endif
%description client
%{dscr}
This package is a meta package requiring the packages
containing the fd and the console.
This is for client only installation.
%description bconsole
%{dscr}
This package contains the bconsole (the CLI interface program)
%description director
%{dscr}
This package contains the Director Service (Bareos main service daemon)
%description storage
%{dscr}
This package contains the Storage Daemon
(Bareos service to read and write data from/to media)
%description storage-tape
%{dscr}
This package contains the Storage Daemon tape support
(Bareos service to read and write data from/to tape media)
%if 0%{?droplet}
%description storage-droplet
%{dscr}
This package contains the Storage backend for Object Storage (through libdroplet).
%endif
%if 0%{?glusterfs}
%description storage-glusterfs
%{dscr}
This package contains the Storage backend for GlusterFS.
%endif
%if 0%{?ceph}
%description storage-ceph
%{dscr}
This package contains the Storage backend for CEPH.
%endif
%description storage-fifo
%{dscr}
This package contains the Storage backend for FIFO files.
This package is only required, when a resource "Archive Device = fifo"
should be used by the Bareos Storage Daemon.
%description filedaemon
%{dscr}
This package contains the File Daemon
(Bareos client daemon to read/write data from the backed up computer)
%description common
%{dscr}
This package contains the shared libraries that are used by multiple daemons and tools.
%description database-common
%{dscr}
This package contains the shared libraries that abstract the catalog interface
%description database-postgresql
%{dscr}
This package contains the shared library to access postgresql as catalog db.
%description database-mysql
%{dscr}
This package contains the shared library to use mysql as catalog db.
%if 0%{?build_sqlite3}
%description database-sqlite3
%{dscr}
This package contains the shared library to use sqlite as catalog db.
%endif
%description database-tools
%{dscr}
This package contains Bareos database tools.
%description tools
%{dscr}
This package contains Bareos tools.
%if 0%{?build_qt_monitor}
%description traymonitor
%{dscr}
This package contains the tray monitor (QT based).
%endif
%description devel
%{dscr}
This package contains bareos development files.
%description regress-config
%{dscr}
This package contains required files for Bareos regression testing.
%prep
# this is a hack so we always build in "bareos" and not in "bareos-version"
%setup -c -n bareos
mv bareos-*/* .
%build
# Cleanup defined in Fedora Packaging:Guidelines
# and required repetitive local build of at least CentOS 5.
if [ "%{?buildroot}" -a "%{?buildroot}" != "/" ]; then
rm -rf "%{?buildroot}"
fi
%if !0%{?suse_version}
export PATH=$PATH:/usr/lib64/qt5/bin:/usr/lib/qt5/bin
%endif
export MTX=/usr/sbin/mtx
mkdir %{CMAKE_BUILDDIR}
pushd %{CMAKE_BUILDDIR}
# use Developer Toolset 7 compiler as standard is too old
%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
export PATH=/opt/rh/devtoolset-7/root/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
%endif
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;
# use our own cmake call instead of cmake macro as it is different on different platforms/versions
cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
-DINCLUDE_INSTALL_DIR:PATH=/usr/include \
-DLIB_INSTALL_DIR:PATH=/usr/lib \
-DSYSCONF_INSTALL_DIR:PATH=/etc \
-DSHARE_INSTALL_PREFIX:PATH=/usr/share \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DDEBUG_PREFIX_MAP:BOOL=OFF \
-Dprefix=%{_prefix}\
-Dlibdir=%{library_dir} \
-Dsbindir=%{_sbindir} \
-Dsbin-perm=755 \
-Dsysconfdir=%{_sysconfdir} \
-Dconfdir=%{_sysconfdir}/bareos \
-Dmandir=%{_mandir} \
-Ddocdir=%{_docdir}/%{name} \
-Dhtmldir=%{_docdir}/%{name}/html \
-Darchivedir=/var/lib/%{name}/storage \
-Dbackenddir=%{backend_dir} \
-Dscriptdir=%{script_dir} \
-Dworkingdir=%{working_dir} \
-Dplugindir=%{plugin_dir} \
-Dpiddir=%{pid_dir} \
-Dbsrdir=%{bsr_dir} \
-Dlogdir=/var/log/bareos \
-Dsubsysdir=%{_subsysdir} \
%if 0%{?python_plugins}
-Dpython=yes \
%endif
-Dreadline=yes \
-Dbatch-insert=yes \
-Ddynamic-cats-backends=yes \
-Ddynamic-storage-backends=yes \
-Dscsi-crypto=yes \
-Dlmdb=yes \
-Dndmp=yes \
-Dipv6=yes \
-Dacl=yes \
-Dxattr=yes \
%if 0%{?build_bat}
-Dbat=yes \
%endif
%if 0%{?build_qt_monitor}
-Dtraymonitor=yes \
%endif
%if 0%{?client_only}
-Dclient-only=yes \
%endif
-Dpostgresql=yes \
-Dmysql=yes \
%if 0%{?build_sqlite3}
-Dsqlite3=yes \
%endif
%if %{use_libwrap}
-Dtcp-wrappers=yes \
%endif
-Ddir-user=%{director_daemon_user} \
-Ddir-group=%{daemon_group} \
-Dsd-user=%{storage_daemon_user} \
-Dsd-group=%{storage_daemon_group} \
-Dfd-user=%{file_daemon_user} \
-Dfd-group=%{daemon_group} \
-Ddir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
-Dfd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
-Dsd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
-Dmon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
-Dmon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
-Dmon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
-Dopenssl=yes \
-Dbasename="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
-Dhostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
%if 0%{?systemd_support}
-Dsystemd=yes \
%endif
-Dincludes=yes \
-DVERSION_STRING=%version
#Add flags
%__make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags};
%check
# run unit tests
pushd %{CMAKE_BUILDDIR}
make clean
ctest -R gtest: -D Continuous || result=$?
result=$?
if [ $result -eq 1 ]; then
echo "ctest result $result is expected and OK"
exit 0
else
echo "ctest result $result is not 1, ERROR"
fi
%install
##if 0#{?suse_version}
# #makeinstall DESTDIR=#{buildroot} install
##else
# make DESTDIR=#{buildroot} install
##endif
#make DESTDIR=#{buildroot} install-autostart
pushd %{CMAKE_BUILDDIR}
make DESTDIR=%{buildroot} install
popd
#rm -Rvf build
install -d -m 755 %{buildroot}/usr/share/applications
install -d -m 755 %{buildroot}/usr/share/pixmaps
install -d -m 755 %{buildroot}%{backend_dir}
install -d -m 755 %{buildroot}%{working_dir}
install -d -m 755 %{buildroot}%{plugin_dir}
#Cleaning
for F in \
%if 0%{?client_only}
%{_mandir}/man1/bregex.1.gz \
%{_mandir}/man1/bsmtp.1.gz \
%{_mandir}/man1/bwild.1.gz \
%{_mandir}/man8/bareos-dbcheck.8.gz \
%{_mandir}/man8/bareos-dir.8.gz \
%{_mandir}/man8/bareos-sd.8.gz \
%{_mandir}/man8/bareos.8.gz \
%{_mandir}/man8/bcopy.8.gz \
%{_mandir}/man8/bextract.8.gz \
%{_mandir}/man8/bls.8.gz \
%{_mandir}/man8/bpluginfo.8.gz \
%{_mandir}/man8/bscan.8.gz \
%{_mandir}/man8/bscrypto.8.gz \
%{_mandir}/man8/btape.8.gz \
%{_sysconfdir}/logrotate.d/bareos-dir \
%{_sysconfdir}/rc.d/init.d/bareos-dir \
%{_sysconfdir}/rc.d/init.d/bareos-sd \
%{script_dir}/disk-changer \
%{script_dir}/mtx-changer \
%{_sysconfdir}/%{name}/mtx-changer.conf \
%endif
%if 0%{?install_suse_fw} == 0
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-dir \
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-sd \
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bareos-fd \
%endif
%if 0%{?systemd_support}
%{_sysconfdir}/rc.d/init.d/bareos-dir \
%{_sysconfdir}/rc.d/init.d/bareos-sd \
%{_sysconfdir}/rc.d/init.d/bareos-fd \
%{_sysconfdir}/init.d/bareos-dir \
%{_sysconfdir}/init.d/bareos-sd \
%{_sysconfdir}/init.d/bareos-fd \
%endif
%{script_dir}/bareos_config \
%{script_dir}/btraceback.dbx \
%{script_dir}/btraceback.mdb \
%{_docdir}/%{name}/INSTALL \
%{_sbindir}/%{name}
do
rm -f "%{buildroot}/$F"
done
# remove links to libraries
# for i in #{buildroot}/#{_libdir}/libbareos*; do printf "$i: "; readelf -a $i | grep SONAME; done
find %{buildroot}/%{library_dir} -type l -name "libbareos*.so" -maxdepth 1 -exec rm {} \;
ls -la %{buildroot}/%{library_dir}
%if ! 0%{?python_plugins}
rm -f %{buildroot}/%{plugin_dir}/python-*.so
rm -f %{buildroot}/%{plugin_dir}/*.py*
rm -f %{buildroot}/%{_sysconfdir}/%{name}/bareos-dir.d/plugin-python-ldap.conf
%endif
%if ! 0%{?glusterfs}
rm -f %{buildroot}/%{script_dir}/bareos-glusterfind-wrapper
%endif
# install tray monitor
# #if 0#{?build_qt_monitor}
# #if 0#{?suse_version} > 1010
# disables, because suse_update_desktop_file complains
# that there are two desktop file (applications and autostart)
# ##suse_update_desktop_file bareos-tray-monitor System Backup
# #endif
# #endif
# remove man page if qt tray monitor is not built
%if !0%{?build_qt_monitor}
rm %{buildroot}%{_mandir}/man1/bareos-tray-monitor.*
%endif
# install systemd service files
%if 0%{?systemd_support}
install -d -m 755 %{buildroot}%{_unitdir}
install -m 644 platforms/systemd/bareos-dir.service %{buildroot}%{_unitdir}
install -m 644 platforms/systemd/bareos-fd.service %{buildroot}%{_unitdir}
install -m 644 platforms/systemd/bareos-sd.service %{buildroot}%{_unitdir}