/
bareos.spec
1025 lines (886 loc) · 27.8 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 Bareos GmbH & Co KG
#
# Redesign of the bareos specfile: goals (20110922)
#
# * only support platforms that are available in OBS
# * activate all options available (if reasonable)
# * single-dir-install is not supported
# * use special group (bconsole) for users that can access bconsole
# * Single packages for:
# * console package
# * dir package ( bsmtp )
# * sd package ( bls + btape + bcopy + bextract )
# * fd package ( )
# * tray monitor
# * bareos-database-{sqlite,postgresql,mysql} (libs) (make_database/tables/grant rights)
# * sql common abstract sql libraries (without db)
# * libs common libraries (without db)
# * tools without link to db libs (bwild, bregex)
# * tools with link to db libs (dbcheck, bscan)
# * bat
# * doc
#
# For openSUSE/SUSE we placed the /usr/sbin/rcscript
# And added the firewall basics rules
#
# Notice : the libbareoscats* package to be able to pass the shlib name policy are
# explicitly named
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
Summary: The Network Backup Solution
Name: bareos
Version: 12.4.1
Release: 1.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 _libversion 12.4.1
%define plugin_dir %_libdir/bareos/plugins
%define script_dir /usr/lib/bareos/scripts
%define working_dir /var/lib/bareos
%define pid_dir /var/lib/bareos
# 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}
%define build_bat 1
%define build_qt_monitor 1
%define build_sqlite3 1
%define systemd 0
# firewall installation
%define install_suse_fw 0
%if 0%{?suse_version} > 1010
%define _fwdefdir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%define install_suse_fw 1
%endif
%if 0%{?suse_version} > 1140 || 0%{?fedora_version} > 14
%define systemd_support 1
%endif
# centos/rhel 5 : segfault when building qt monitor
%if 0%{?centos_version} == 505 || 0%{?rhel_version} == 505
%define build_bat 0
%define build_qt_monitor 0
%endif
%if 0%{?sles_version} == 10
%define build_bat 0
%define build_qt_monitor 0
%define build_sqlite3 0
%endif
%if 0%{?systemd_support}
BuildRequires: systemd
%{?systemd_requires}
%endif
Source0: %{name}_%{version}.tar.gz
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
%if 0%{?build_sqlite3}
%if 0%{?suse_version}
BuildRequires: sqlite3-devel
%else
BuildRequires: sqlite-devel
%endif
%endif
BuildRequires: mysql-devel
BuildRequires: postgresql-devel
BuildRequires: libqt4-devel
BuildRequires: openssl
BuildRequires: libcap-devel
BuildRequires: mtx
%if 0%{?suse_version}
# link identical files
BuildRequires: fdupes
BuildRequires: termcap
BuildRequires: pwdutils
BuildRequires: tcpd-devel
BuildRequires: update-desktop-files
# Some magic to be able to determine what platform we are running on.
%if !0%{sles_version}
BuildRequires: openSUSE-release
%else
%if 0%{?sles_version} && !0%{?sled_version}
BuildRequires: sles-release
%else
BuildRequires: sled-release
%endif
%endif
BuildRequires: lsb-release
%else
BuildRequires: qt4-devel
BuildRequires: libtermcap-devel
BuildRequires: passwd
BuildRequires: tcp_wrappers
# Some magic to be able to determine what platform we are running on.
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
%if 0%{?fedora_version}
BuildRequires: fedora-release
%endif
# Favor lsb_release on platform that have proper support for it.
%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version}
BuildRequires: redhat-lsb
%else
# Older RHEL (5)/ CentOS (5)
BuildRequires: redhat-release
%endif
%else
# Non redhat like distribution for example mandriva.
BuildRequires: lsb-release
%endif
%endif
%if 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?fedora_version} >= 14
BuildRequires: tcp_wrappers-devel
%endif
Summary: Bares All-In-One package (dir,sd,fd)
#BuildArch: noarch
Requires: %{name}-director = %{version}
Requires: %{name}-storage = %{version}
Requires: %{name}-client = %{version}
%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.
%description
%{dscr}
# Notice : Don't try to change the order of package declaration
# You will have side effect with PreReq
%package bconsole
Summary: Provide ncurses administration console
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
%package client
# contains bconsole, fd, libs
Summary: Meta-All-In-One package client 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: Provide bareos director daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: %{name}-database-common = %{version}
%if 0%{?suse_version}
# Don't use this option on anything other then SUSE derived distributions
# as Fedora & others don't know this tag
Recommends: %{name}-database-tools
Recommends: logrotate
%endif
Provides: %{name}-dir
%package storage
Summary: Provide bareos storage daemon
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Requires: mtx
Provides: %{name}-sd
%package filedaemon
Summary: Provide bareos file daemon service
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
Provides: %{name}-fd
%package common
Summary: Generic libs needed by every package
Group: Productivity/Archiving/Backup
Provides: %{name}-libs
%package database-common
Summary: Generic abstration lib for the sql catalog
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
Requires: %{name}-database-common = %{version}
Provides: %{name}-catalog-sqlite3
Provides: %{name}-database-backend
%endif
%package database-tools
Summary: Provides bareos-dbcheck, bscan
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}, %{name}-database-common = %{version}
Provides: %{name}-dbtools
%package tools
Summary: Provides bcopy, bextract, bls, bregex, bwild
Group: Productivity/Archiving/Backup
Requires: %{name}-common = %{version}
%if 0%{build_qt_monitor}
%package traymonitor
Summary: Qt based tray monitor
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
%if 0%{?build_bat}
%package bat
Summary: Provide Bareos Admin Tool gui
Group: Productivity/Archiving/Backup
%endif
%package devel
Summary: Devel headers
Group: Development/Languages/C and C++
Requires: %{name}-common = %{version}
Requires: tcpd-devel
Requires: zlib-devel
Requires: libacl-devel
Requires: libmysqlclient-devel
Requires: postgresql-devel
%if 0%{?build_sqlite3}
%if 0%{?suse_version}
Requires: sqlite3-devel
%else
Requires: sqlite-devel
%endif
%endif
Requires: libopenssl-devel
Requires: libcap-devel
%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 filedaemon
%{dscr}
This package contains the File Daemon
(Bareoss 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 bareoss database tools.
%description tools
%{dscr}
This package contains bareoss tools.
%if 0%{?build_qt_monitor}
%description traymonitor
%{dscr}
This package contains the new tray monitor that uses qt.
%endif
%if 0%{?build_bat}
%description bat
%{dscr}
This package contains the Bareos Admin Tool (BAT).
Bat is a graphical interface for bareos.
%endif
%description devel
%{dscr}
This package contains bareos development files.
%prep
%setup
%build
%if %{undefined suse_version}
export PATH=$PATH:/usr/lib64/qt4/bin:/usr/lib/qt4/bin
%endif
export MTX=/usr/sbin/mtx
# Notice keep the upstream order of ./configure --help
%configure \
--prefix=%{_prefix} \
--sbindir=%{_sbindir} \
--with-sbin-perm=755 \
--sysconfdir=%{_sysconfdir}/bareos \
--mandir=%{_mandir} \
--docdir=%{_docdir}/%{name} \
--htmldir=%{_docdir}/%{name}/html \
--with-scriptdir=%{script_dir} \
--with-working-dir=%{working_dir} \
--with-plugindir=%{plugin_dir} \
--with-pid-dir=%{pid_dir} \
--with-subsys-dir=%{_subsysdir} \
--enable-smartalloc \
--disable-conio \
--enable-readline \
--enable-batch-insert \
--enable-dynamic-cats-backends \
--enable-scsi-crypto \
--enable-ndmp \
--enable-ipv6 \
--enable-acl \
--enable-xattr \
%if 0%{?build_bat}
--enable-bat \
%endif
--with-postgresql \
--with-mysql \
%if 0%{?build_sqlite3}
--with-sqlite3 \
%endif
--with-tcp-wrappers \
--with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
--with-sd-user=%{storage_daemon_user} \
--with-sd-group=%{storage_daemon_group} \
--with-fd-user=%{file_daemon_user} \
--with-fd-group=%{daemon_group} \
--with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
--with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
--with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
--with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
--with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
--with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
--with-openssl \
--with-basename="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
--with-hostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
%if 0%{?systemd_support}
--with-systemd \
%endif
--enable-includes
#Add flags
%__make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags};
%if 0%{?build_qt_monitor}
# build and tray-monitor manually, as this is not build and installed by make
cd src/qt-console/tray-monitor
qmake tray-monitor.pro
%__make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
cd -
%endif
%install
%if 0%{?suse_version}
# work-around for SLE_11
#%%install -d 755 %%{buildroot}%%{_sysconfdir}/init.d
%makeinstall DESTDIR=%{buildroot} install
%else
#%%install -d 755 %%{buildroot}%%{_sysconfdir}/rc.d/init.d
make DESTDIR=%{buildroot} install
%endif
install -d 755 %{buildroot}/usr/share/applications
install -d 755 %{buildroot}/usr/share/pixmaps
install -d 755 %{buildroot}%{working_dir}
#Cleaning
for F in \
%{script_dir}/bareos \
%{script_dir}/bareos_config \
%{script_dir}/btraceback.dbx \
%{script_dir}/btraceback.mdb \
%{script_dir}/bareos-ctl-dir \
%{script_dir}/bareos-ctl-fd \
%{script_dir}/bareos-ctl-sd \
%{_docdir}/%{name}/INSTALL \
%{_sbindir}/%{name}
do
rm -f "%{buildroot}/$F"
done
# install tray monitor
%if 0%{?build_qt_monitor}
install -m 755 src/qt-console/tray-monitor/.libs/bareos-tray-monitor %{buildroot}%{_sbindir}/bareos-tray-monitor-qt
install -m 644 src/qt-console/tray-monitor/tray-monitor.conf %{buildroot}%{_sysconfdir}/bareos/
%endif
%if 0%{?build_bat}
# install bat
install -m 755 src/qt-console/.libs/bat %{buildroot}%{_sbindir}
install -m 640 src/qt-console/bat.conf %{buildroot}%{_sysconfdir}/bareos/bat.conf
install -m 644 src/qt-console/images/bat_icon.png %{buildroot}/usr/share/pixmaps/bat_icon.png
%if 0%{?suse_version} > 1010
%suse_update_desktop_file -c bat bat "bareos the network backup solution - BAT Bareos Admin Tool" bat bat_icon System Backup
%suse_update_desktop_file -i bat System Backup
%else
install -m 644 scripts/bat.desktop %{buildroot}/usr/share/applications/
%endif
%endif
# end build_bat
%if 0%{build_qt_monitor}
# tray monitor desktop file
install -d 755 %{buildroot}/etc/xdg/autostart
install -m 644 scripts/bareos-tray-monitor.desktop %{buildroot}/usr/share/applications/
%if 0%{?suse_version} > 1010
%suse_update_desktop_file -i -r bareos-tray-monitor System Backup
%endif
# copy to autostart directory
install -m 644 %{buildroot}/usr/share/applications/bareos-tray-monitor.desktop %{buildroot}/etc/xdg/autostart
# tray monitor icon
install -m 644 scripts/tray-monitor.xpm %{buildroot}/usr/share/pixmaps/bareos-tray-monitor.xpm
%endif
# install the sample-query.sql file as default query file
#install -m 644 examples/sample-query.sql %{buildroot}%{script_dir}/query.sql
# we create that for SLES & RHEL5
touch %{buildroot}%{working_dir}/log
chmod 0640 %{buildroot}%{working_dir}/log
# remove man page if bat is not built
%if !0%{?build_bat}
rm %{buildroot}%{_mandir}/man1/bat.1.gz
%endif
# remove man page if qt tray monitor is not built
%if !0%{?build_qt_monitor}
rm %{buildroot}%{_mandir}/man1/bareos-tray-monitor.1.gz
%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}
%endif
# Create the Readme files for the meta packages
[ -d %{buildroot}%{_docdir}/%{name}/ ] || install -d -m 755 %{buildroot}%{_docdir}/%{name}
echo "This meta package emulates the former bareos-client package" > %{buildroot}%{_docdir}/%{name}/README.bareos-client
echo "This is a meta package to install a full bareos system" > %{buildroot}%{_docdir}/%{name}/README.bareos
%files
%defattr(-, root, root)
%{_docdir}/%{name}/README.bareos
%files client
%defattr(-, root, root)
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/README.bareos-client
%files bconsole
# console package
%defattr(-, root, root)
%attr(0640, root, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bconsole.conf
%{script_dir}/bconsole
%{_sbindir}/bconsole
%{_mandir}/man8/bconsole.8.gz
%files director
# dir package (bareos-dir, bsmtp)
%defattr(-, root, root)
%if 0%{?suse_version}
%{_sysconfdir}/init.d/bareos-dir
%{_sbindir}/rcbareos-dir
%if 0%{?install_suse_fw}
# use noreplace if user has adjusted its list of IP
%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-dir
%endif
%else
%{_sysconfdir}/rc.d/init.d/bareos-dir
%endif
%attr(0640, %{director_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-dir.conf
%attr(-, root, %{daemon_group}) %dir %{_sysconfdir}/bareos
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-dir
%{plugin_dir}/*-dir.so
%{script_dir}/delete_catalog_backup
%{script_dir}/make_catalog_backup
%{_sbindir}/bareos-dir
%{_sbindir}/bsmtp
%dir %{_docdir}/%{name}
#%{_docdir}/%{name}/ChangeLog
#%{_docdir}/%{name}/LICENSE
#%{_docdir}/%{name}/README
#%{_docdir}/%{name}/ReleaseNotes
#%{_docdir}/%{name}/technotes
#%{_docdir}/%{name}/VERIFYING
%{_mandir}/man1/bsmtp.1.gz
%{_mandir}/man8/bareos-dir.8.gz
%{_mandir}/man8/bareos.8.gz
# This is not a config file, but we need what %config is able to do
# the query.sql can be personalized by end user.
# a rpmlint rule is add to filter the warning
#%config(noreplace) %{script_dir}/query.sql
%if 0%{?systemd_support}
%{_unitdir}/bareos-dir.service
%endif
%files storage
# sd package (bareos-sd, bls, btape, bcopy, bextract)
%defattr(-, root, root)
%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-sd.conf
%if 0%{?suse_version}
%{_sysconfdir}/init.d/bareos-sd
%{_sbindir}/rcbareos-sd
%if 0%{?install_suse_fw}
# use noreplace if user has adjusted its list of IP
%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-sd
%endif
%else
%{_sysconfdir}/rc.d/init.d/bareos-sd
%endif
%{_sbindir}/bscrypto
%{plugin_dir}/*-sd.so
%{script_dir}/disk-changer
%{script_dir}/mtx-changer
%config(noreplace) %{_sysconfdir}/bareos/mtx-changer.conf
%{_sbindir}/bareos-sd
%{_mandir}/man8/bscrypto.8.gz
%{_mandir}/man8/bareos-sd.8.gz
%{_mandir}/man8/btape.8.gz
%{_sbindir}/btape
%if 0%{?systemd_support}
%{_unitdir}/bareos-sd.service
%endif
%files filedaemon
# fd package (bareos-fd, plugins)
%defattr(-, root, root)
%attr(0640, %{file_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-fd.conf
%if 0%{?suse_version}
%{_sysconfdir}/init.d/bareos-fd
%{_sbindir}/rcbareos-fd
%if 0%{?install_suse_fw}
# use noreplace if user has adjusted its list of IP
%attr(0644, root, root) %config(noreplace) %{_fwdefdir}/bareos-fd
%endif
%else
%{_sysconfdir}/rc.d/init.d/bareos-fd
%endif
%{_sbindir}/bareos-fd
%{plugin_dir}/*-fd.so
%{_mandir}/man8/bareos-fd.8.gz
# tray monitor
%if 0%{?systemd_support}
%{_unitdir}/bareos-fd.service
%endif
%files common
# common shared libraries (without db)
%defattr(-, root, root)
%{_libdir}/libbareos-%{_libversion}.so
%{_libdir}/libbareos.so
%{_libdir}/libbareoscfg-%{_libversion}.so
%{_libdir}/libbareoscfg.so
%{_libdir}/libbareosfind-%{_libversion}.so
%{_libdir}/libbareosfind.so
%{_libdir}/libbareosndmp-%{_libversion}.so
%{_libdir}/libbareosndmp.so
#
# Generic stuff needed for all software so stuffed into libs package
#
%if "%{_libdir}/bareos/" != "/usr/lib/bareos/"
%dir %{_libdir}/bareos/
%endif
%dir /usr/lib/bareos/
%dir %{script_dir}
%dir %{plugin_dir}
%{_sbindir}/btraceback
%{_mandir}/man8/btraceback.8.gz
%{script_dir}/bareos-config
%{script_dir}/btraceback.gdb
%attr(770 %{daemon_user}, %{daemon_group}) %dir %{working_dir}
%attr(640, %{daemon_user}, %{daemon_group}) %ghost %{working_dir}/log
%files database-common
# catalog independent files
%defattr(-, root, root)
%{_libdir}/libbareossql.so
%{_libdir}/libbareoscats.so
%{_libdir}/libbareossql-%{_libversion}.so
%{_libdir}/libbareoscats-%{_libversion}.so
%{script_dir}/create_bareos_database
%{script_dir}/drop_bareos_database
%{script_dir}/drop_bareos_tables
%{script_dir}/grant_bareos_privileges
%{script_dir}/make_bareos_tables
%{script_dir}/update_bareos_tables
%files database-postgresql
# postgresql catalog files
%defattr(-, root, root)
%{script_dir}/*_postgresql_*
%{_libdir}/libbareoscats-postgresql.so
%{_libdir}/libbareoscats-postgresql-%{_libversion}.so
%files database-mysql
# mysql catalog files
%defattr(-, root, root)
%{script_dir}/*_mysql_*
%{_libdir}/libbareoscats-mysql.so
%{_libdir}/libbareoscats-mysql-%{_libversion}.so
%if 0%{?build_sqlite3}
%files database-sqlite3
# sqlite3 catalog files
%defattr(-, root, root)
%{script_dir}/*_sqlite3_*
%{_libdir}/libbareoscats-sqlite3.so
%{_libdir}/libbareoscats-sqlite3-%{_libversion}.so
%endif
%files database-tools
# dbtools with link to db libs (dbcheck, bscan)
%defattr(-, root, root)
%{_sbindir}/bareos-dbcheck
%{_sbindir}/bscan
%{script_dir}/make_catalog_backup.pl
%{_mandir}/man8/bareos-dbcheck.8.gz
%{_mandir}/man8/bscan.8.gz
%files tools
# tools without link to db libs (bwild, bregex)
%defattr(-, root, root)
%{_sbindir}/bcopy
%{_sbindir}/bextract
%{_sbindir}/bls
%{_sbindir}/bregex
%{_sbindir}/bwild
%{_sbindir}/bpluginfo
%{_mandir}/man8/bcopy.8.gz
%{_mandir}/man8/bextract.8.gz
%{_mandir}/man8/bls.8.gz
%{_mandir}/man8/bwild.8.gz
%{_mandir}/man8/bregex.8.gz
%{_mandir}/man8/bpluginfo.8.gz
%if 0%{?build_qt_monitor}
%files traymonitor
%defattr(-,root, root)
%attr(-, root, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/tray-monitor.conf
%{_sbindir}/bareos-tray-monitor-qt
%{_mandir}/man1/bareos-tray-monitor.1.gz
%config %{_sysconfdir}/xdg/autostart/bareos-tray-monitor.desktop
/usr/share/applications/bareos-tray-monitor.desktop
/usr/share/pixmaps/bareos-tray-monitor.xpm
%endif
%if 0%{?build_bat}
%files bat
%defattr(-, root, root)
%attr(-, root, %{daemon_group}) %{_sbindir}/bat
%attr(640, root, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bat.conf
%{_prefix}/share/pixmaps/bat_icon.png
%{_prefix}/share/applications/bat.desktop
%{_mandir}/man1/bat.1.gz
%dir %{_docdir}/%{name}
%dir %{_docdir}/%{name}/html
%{_docdir}/%{name}/html/clients.html
%{_docdir}/%{name}/html/console.html
%{_docdir}/%{name}/html/filesets.html
%{_docdir}/%{name}/html/index.html
%{_docdir}/%{name}/html/joblist.html
%{_docdir}/%{name}/html/jobplot.html
%{_docdir}/%{name}/html/jobs.html
%{_docdir}/%{name}/html/restore.html
%{_docdir}/%{name}/html/status.png
%{_docdir}/%{name}/html/storage.html
%{_docdir}/%{name}/html/mail-message-new.png
%{_docdir}/%{name}/html/media.html
%endif
%files devel
%defattr(-, root, root)
/usr/include/bareos
%{_libdir}/*.la
#
# Define some macros for updating the system settings.
# SUSE has most macros by default others have not so we
# define the missing here.
#
%if 0%{?suse_version}
%define add_service_start() \
/bin/true \
%nil
%else
%if 0%{?systemd_support}
%define add_service_start() \
/bin/systemctl daemon-reload >/dev/null 2>&1 || true \
%nil
%define stop_on_removal() \
/bin/systemctl --no-reload disable %1.service > /dev/null 2>&1 || \
/bin/systemctl stop %1.service > /dev/null 2>&1 || true \
%nil
%define restart_on_update() \
/bin/systemctl try-restart %1.service >/dev/null 2>&1 || true \
%nil
%else
%define add_service_start() \
/sbin/chkconfig --add %1 \
%nil
%define stop_on_removal() \
/sbin/service %1 stop >/dev/null 2>&1 || \
/sbin/chkconfig --del %1 || true \
%nil
%define restart_on_update() \
/sbin/service %1 condrestart >/dev/null 2>&1 || true \
%nil
%endif
%define insserv_cleanup() \
/bin/true \
%nil
%endif
%post director
%{script_dir}/bareos-config initialize_local_hostname
%{script_dir}/bareos-config initialize_passwords
%{script_dir}/bareos-config initialize_database_driver
%add_service_start bareos-dir
%post storage
%{script_dir}/bareos-config initialize_local_hostname
%{script_dir}/bareos-config initialize_passwords
%add_service_start bareos-sd
%post filedaemon
%{script_dir}/bareos-config initialize_local_hostname
%{script_dir}/bareos-config initialize_passwords
%add_service_start bareos-fd
%post bconsole
%{script_dir}/bareos-config initialize_local_hostname
%{script_dir}/bareos-config initialize_passwords
%post common
/sbin/ldconfig
%postun common
/sbin/ldconfig
%post database-common
/sbin/ldconfig
%postun database-common
/sbin/ldconfig
%post database-postgresql
/sbin/ldconfig
%postun database-postgresql
/sbin/ldconfig
%post database-mysql
/sbin/ldconfig
%postun database-mysql
/sbin/ldconfig
%if 0%{?build_sqlite3}
%post database-sqlite3
/sbin/ldconfig
%postun database-sqlite3
/sbin/ldconfig
%endif
%if 0%{?build_qt_monitor}
# TODO: only provide bareos-traymonitor
%post traymonitor
%{script_dir}/bareos-config initialize_local_hostname
%{script_dir}/bareos-config initialize_passwords
echo "linking %{_sbindir}/bareos-tray-monitor-qt %{_sbindir}/bareos-traymonitor"
ln -sf %{_sbindir}/bareos-tray-monitor-qt %{_sbindir}/bareos-traymonitor
%endif
%if 0%{?build_bat}
%post bat
%{script_dir}/bareos-config initialize_local_hostname
%endif
%pre director
if [ "%{director_daemon_user}" != "root" -a "%{director_daemon_user}" != "%{daemon_user}" ]; then
getent passwd %{director_daemon_user} > /dev/null || useradd -r -c "Bareos" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user}
fi
exit 0
%pre storage
#
# See what secondary groups exist for the sd user to be added to.
#
SEC_GROUPS="tape disk"
ADD_GROUPS=""
for sec_group in ${SEC_GROUPS}
do
cnt=`getent group ${sec_group} | wc -l`
if [ ${cnt} -gt 0 ]; then
[ -z ${ADD_GROUPS} ] && ADD_GROUPS="${sec_group}" || ADD_GROUPS="${ADD_GROUPS},${sec_group}"
fi
done
if [ "%{storage_daemon_group}" != "%{daemon_group}" ]; then
getent group %{storage_daemon_group} > /dev/null || groupadd -r %{storage_daemon_group}
fi
#
# If the user doesn't exist create a new one otherwise modify it to have
# the wanted secondary groups.
#
if [ "%{storage_daemon_user}" != "root" -a "%{storage_daemon_user}" != "%{daemon_user}" ]; then
getent passwd %{storage_daemon_user} > /dev/null
if [ $? = 0 ]; then
#
# Make sure the correct primary group is set otherwise fix it.
#
if [ `id -gn %{storage_daemon_user}` != %{storage_daemon_group} ]; then
usermod -g %{storage_daemon_group} %{storage_daemon_user}
fi
#
# Make sure storage_daemon_user is part of the wanted secondary groups
#
usermod -G ${ADD_GROUPS} %{storage_daemon_user}
else
#
# Create a new storage_daemon_user
#
useradd -r -c "Bareos" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user}
#
# Make sure storage_daemon_user is part of the wanted secondary groups
#
usermod -G ${ADD_GROUPS} %{storage_daemon_user}
fi
else
#
# Make sure storage_daemon_user is part of the wanted secondary groups
#
usermod -G ${ADD_GROUPS} %{storage_daemon_user}
fi
exit 0
%pre filedaemon
if [ "%{file_daemon_user}" != "root" -a "%{file_daemon_user}" != "%{daemon_user}" ]; then
getent passwd %{file_daemon_user} > /dev/null || useradd -r -c "Bareos" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user}
fi
exit 0
%pre common
getent group %{daemon_group} > /dev/null || groupadd -r %{daemon_group}
getent passwd %{daemon_user} > /dev/null || useradd -r -c "Bareos" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{daemon_user}
exit 0
%preun director
if [ "$1" = 0 ]; then
%stop_on_removal bareos-dir
fi
%preun storage
if [ "$1" = 0 ]; then
%stop_on_removal bareos-sd
fi