-
Notifications
You must be signed in to change notification settings - Fork 1
/
samba.spec
3870 lines (3152 loc) · 129 KB
/
samba.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
# rpmbuild --rebuild --with testsuite --without clustering samba.src.rpm
#
# The testsuite is disabled by default. Set --with testsuite or bcond_without
# to run the Samba torture testsuite.
%bcond_with testsuite
# ctdb is enabled by default, you can disable it with: --without clustering
%bcond_without clustering
%bcond_without configure
%define __spec_install_pre %{___build_pre}
%define main_release 0.030fd72
%define samba_version 4.5.1
%define talloc_version 2.1.7
%define tdb_version 1.3.9
%define tevent_version 0.9.28
%define ldb_version 1.1.26
# This should be rc1 or nil
%define pre_release %nil
%if "x%{?pre_release}" != "x"
%define samba_release 0.%{main_release}.%{pre_release}%{?dist}
%else
%define samba_release %{main_release}%{?dist}
%endif
# This is a network daemon, do a hardened build
# Enables PIE and full RELRO protection
%global _hardened_build 1
%global with_libsmbclient 1
%global with_libwbclient 1
%global with_internal_talloc 1
%global with_internal_tevent 1
%global with_internal_tdb 1
%global with_internal_ldb 1
%global with_profiling 1
%global with_vfs_cephfs 1
%if 0%{?rhel}
%global with_vfs_cephfs 0
%endif
%global with_vfs_glusterfs 1
%if 0%{?rhel}
%global with_vfs_glusterfs 0
# Only enable on x86_64
%ifarch x86_64
%global with_vfs_glusterfs 1
%endif
%endif
%global libwbc_alternatives_version 0.13
%global libwbc_alternatives_suffix %nil
%if 0%{?__isa_bits} == 64
%global libwbc_alternatives_suffix -64
%endif
%global with_mitkrb5 1
%global with_dc 0
%if %{with testsuite}
# The testsuite only works with a full build right now.
%global with_mitkrb5 0
%global with_dc 1
%endif
%global with_clustering_support 0
%if %{with clustering}
%global with_clustering_support 1
%endif
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: samba
Version: %{samba_version}
Release: %{samba_release}
%if 0%{?rhel}
Epoch: 0
%else
Epoch: 2
%endif
%if 0%{?epoch} > 0
%define samba_depver %{epoch}:%{version}-%{release}
%else
%define samba_depver %{version}-%{release}
%endif
Summary: Server and Client software to interoperate with Windows machines
License: GPLv3+ and LGPLv3+
Group: System Environment/Daemons
URL: http://www.samba.org/
Source0: samba-%{version}%{pre_release}.tar.gz
# Red Hat specific replacement-files
Source1: samba.log
Source2: samba.xinetd
Source4: smb.conf.default
Source5: pam_winbind.conf
Source6: samba.pamd
Source200: README.dc
Source201: README.downgrade
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires(pre): /usr/sbin/groupadd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires(pre): %{name}-common = %{samba_depver}
Requires: %{name}-common-libs = %{samba_depver}
Requires: %{name}-common-tools = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
Requires: pam
Provides: samba4 = %{samba_depver}
Obsoletes: samba4 < %{samba_depver}
# We don't build it outdated docs anymore
Provides: samba-doc = %{samba_depver}
Obsoletes: samba-doc < %{samba_depver}
# Is not supported yet
Provides: samba-domainjoin-gui = %{samba_depver}
Obsoletes: samba-domainjoin-gui < %{samba_depver}
# SWAT been deprecated and removed from samba
Provides: samba-swat = %{samba_depver}
Obsoletes: samba-swat < %{samba_depver}
Provides: samba4-swat = %{samba_depver}
Obsoletes: samba4-swat < %{samba_depver}
BuildRequires: cups-devel
BuildRequires: dbus-devel
BuildRequires: docbook-style-xsl
BuildRequires: e2fsprogs-devel
BuildRequires: gawk
BuildRequires: krb5-devel >= 1.10
BuildRequires: libacl-devel
BuildRequires: libaio-devel
BuildRequires: libarchive-devel
BuildRequires: libattr-devel
BuildRequires: libcap-devel
BuildRequires: libuuid-devel
BuildRequires: libxslt
BuildRequires: ncurses-devel
BuildRequires: openldap-devel
BuildRequires: pam-devel
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Parse::Yapp)
BuildRequires: popt-devel
BuildRequires: python-devel
BuildRequires: python-tevent
BuildRequires: quota-devel
BuildRequires: readline-devel
BuildRequires: sed
BuildRequires: xfsprogs-devel
BuildRequires: zlib-devel >= 1.2.3
BuildRequires: pkgconfig(libsystemd-daemon)
BuildRequires: pkgconfig(libsystemd)
%if %{with_vfs_glusterfs}
BuildRequires: glusterfs-api-devel >= 3.4.0.16
BuildRequires: glusterfs-devel >= 3.4.0.16
%endif
%if %{with_vfs_cephfs}
BuildRequires: libcephfs1-devel
%endif
%if %{with_dc}
BuildRequires: gnutls-devel >= 3.4.7
%endif
# pidl requirements
BuildRequires: perl(Parse::Yapp)
%if ! %with_internal_talloc
%global libtalloc_version 2.1.7
BuildRequires: libtalloc-devel >= %{libtalloc_version}
BuildRequires: pytalloc-devel >= %{libtalloc_version}
%endif
%if ! %with_internal_tevent
%global libtevent_version 0.9.28
BuildRequires: libtevent-devel >= %{libtevent_version}
BuildRequires: python-tevent >= %{libtevent_version}
%endif
%if ! %with_internal_ldb
%global libldb_version 1.1.26
BuildRequires: libldb-devel >= %{libldb_version}
BuildRequires: pyldb-devel >= %{libldb_version}
%endif
%if ! %with_internal_tdb
%global libtdb_version 1.3.9
BuildRequires: libtdb-devel >= %{libtdb_version}
BuildRequires: python-tdb >= %{libtdb_version}
%endif
%if %{with testsuite}
BuildRequires: ldb-tools
%endif
# filter out perl requirements pulled in from examples in the docdir.
%{?filter_setup:
%filter_provides_in %{_docdir}
%filter_requires_in %{_docdir}
%filter_setup
}
### SAMBA
%description
Samba is the standard Windows interoperability suite of programs for Linux and
Unix.
### CLIENT
%package client
Summary: Samba client programs
Group: Applications/System
Requires(pre): %{name}-common = %{samba_depver}
Requires: %{name}-common-libs = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
%if %with_libsmbclient
Requires: libsmbclient = %{samba_depver}
%endif
Provides: samba4-client = %{samba_depver}
Obsoletes: samba4-client < %{samba_depver}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description client
The %{name}-client package provides some SMB/CIFS clients to complement
the built-in SMB/CIFS filesystem in Linux. These clients allow access
of SMB/CIFS shares and printing to SMB/CIFS printers.
### CLIENT-LIBS
%package client-libs
Summary: Samba client libraries
Group: Applications/System
Requires(pre): %{name}-common = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
%description client-libs
The samba-client-libs package contains internal libraries needed by the
SMB/CIFS clients.
### COMMON
%package common
Summary: Files used by both Samba servers and clients
Group: Applications/System
BuildArch: noarch
Requires(post): systemd
Provides: samba4-common = %{samba_depver}
Obsoletes: samba4-common < %{samba_depver}
%description common
samba-common provides files necessary for both the server and client
packages of Samba.
### COMMON-LIBS
%package common-libs
Summary: Libraries used by both Samba servers and clients
Group: Applications/System
Requires(pre): samba-common = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
%description common-libs
The samba-common-libs package contains internal libraries needed by the
SMB/CIFS clients.
### COMMON-TOOLS
%package common-tools
Summary: Tools for Samba servers and clients
Group: Applications/System
Requires: samba-common-libs = %{samba_depver}
Requires: samba-client-libs = %{samba_depver}
Requires: samba-libs = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
%description common-tools
The samba-common-tools package contains tools for Samba servers and
SMB/CIFS clients.
### DC
%package dc
Summary: Samba AD Domain Controller
Group: Applications/System
Requires: %{name} = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Requires: %{name}-dc-libs = %{samba_depver}
Requires: %{name}-python = %{samba_depver}
Requires: %{name}-winbind = %{samba_depver}
# samba-tool requirements
Requires: python-crypto
Provides: samba4-dc = %{samba_depver}
Obsoletes: samba4-dc < %{samba_depver}
%description dc
The samba-dc package provides AD Domain Controller functionality
### DC-LIBS
%package dc-libs
Summary: Samba AD Domain Controller Libraries
Group: Applications/System
Requires: %{name}-common-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Provides: samba4-dc-libs = %{samba_depver}
Obsoletes: samba4-dc-libs < %{samba_depver}
%description dc-libs
The %{name}-dc-libs package contains the libraries needed by the DC to
link against the SMB, RPC and other protocols.
### DEVEL
%package devel
Summary: Developer tools for Samba libraries
Group: Development/Libraries
Requires: %{name}-libs = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Provides: samba4-devel = %{samba_depver}
Obsoletes: samba4-devel < %{samba_depver}
%description devel
The %{name}-devel package contains the header files for the libraries
needed to develop programs that link against the SMB, RPC and other
libraries in the Samba suite.
### CEPH
%if %{with_vfs_cephfs}
%package vfs-cephfs
Summary: Samba VFS module for Ceph distributed storage system
Group: Applications/System
Requires: libcephfs1
Requires: %{name} = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
%description vfs-cephfs
Samba VFS module for Ceph distributed storage system integration.
%endif
### GLUSTER
%if %{with_vfs_glusterfs}
%package vfs-glusterfs
Summary: Samba VFS module for GlusterFS
Group: Applications/System
Requires: glusterfs-api >= 3.4.0.16
Requires: glusterfs >= 3.4.0.16
Requires: %{name} = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Obsoletes: samba-glusterfs < %{samba_depver}
Provides: samba-glusterfs = %{samba_depver}
%description vfs-glusterfs
Samba VFS module for GlusterFS integration.
%endif
### KRB5-PRINTING
%package krb5-printing
Summary: Samba CUPS backend for printing with Kerberos
Group: Applications/System
Requires(pre): %{name}-client
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description krb5-printing
If you need Kerberos for print jobs to a printer connection to cups via the SMB
backend, then you need to install that package. It will allow cups to access
the Kerberos credentials cache of the user issuing the print job.
### LIBS
%package libs
Summary: Samba libraries
Group: Applications/System
Requires: krb5-libs >= 1.10
Requires: %{name}-client-libs = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
Provides: samba4-libs = %{samba_depver}
Obsoletes: samba4-libs < %{samba_depver}
%description libs
The %{name}-libs package contains the libraries needed by programs that
link against the SMB, RPC and other protocols provided by the Samba suite.
### LIBSMBCLIENT
%if %with_libsmbclient
%package -n libsmbclient
Summary: The SMB client library
Group: Applications/System
Requires(pre): %{name}-common = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
%description -n libsmbclient
The libsmbclient contains the SMB client library from the Samba suite.
%package -n libsmbclient-devel
Summary: Developer tools for the SMB client library
Group: Development/Libraries
Requires: libsmbclient = %{samba_depver}
%description -n libsmbclient-devel
The libsmbclient-devel package contains the header files and libraries needed to
develop programs that link against the SMB client library in the Samba suite.
%endif # with_libsmbclient
### LIBWBCLIENT
%if %with_libwbclient
%package -n libwbclient
Summary: The winbind client library
Group: Applications/System
Requires: %{name}-client-libs = %{samba_depver}
%description -n libwbclient
The libwbclient package contains the winbind client library from the Samba suite.
%package -n libwbclient-devel
Summary: Developer tools for the winbind library
Group: Development/Libraries
Requires: libwbclient = %{samba_depver}
Provides: samba-winbind-devel = %{samba_depver}
Obsoletes: samba-winbind-devel < %{samba_depver}
%description -n libwbclient-devel
The libwbclient-devel package provides developer tools for the wbclient library.
%endif # with_libwbclient
### PYTHON
%package python
Summary: Samba Python libraries
Group: Applications/System
Requires: %{name} = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Requires: python-tevent
Requires: python-tdb
Requires: pyldb
Requires: pytalloc
Provides: samba4-python = %{samba_depver}
Obsoletes: samba4-python < %{samba_depver}
%description python
The %{name}-python package contains the Python libraries needed by programs
that use SMB, RPC and other Samba provided protocols in Python programs.
### PIDL
%package pidl
Summary: Perl IDL compiler
Group: Development/Tools
Requires: perl(Parse::Yapp)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
BuildArch: noarch
Provides: samba4-pidl = %{samba_depver}
Obsoletes: samba4-pidl < %{samba_depver}
%description pidl
The %{name}-pidl package contains the Perl IDL compiler used by Samba
and Wireshark to parse IDL and similar protocols
### TEST
%package test
Summary: Testing tools for Samba servers and clients
Group: Applications/System
Requires: %{name} = %{samba_depver}
Requires: %{name}-common = %{samba_depver}
Requires: %{name}-winbind = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Requires: %{name}-test-libs = %{samba_depver}
%if %with_dc
Requires: %{name}-dc-libs = %{samba_depver}
%endif
Requires: %{name}-libs = %{samba_depver}
%if %with_libsmbclient
Requires: libsmbclient = %{samba_depver}
%endif
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
Provides: samba4-test = %{samba_depver}
Obsoletes: samba4-test < %{samba_depver}
%description test
%{name}-test provides testing tools for both the server and client
packages of Samba.
### TEST-LIBS
%package test-libs
Summary: Libraries need by the testing tools for Samba servers and clients
Group: Applications/System
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Provides: %{name}-test-devel = %{samba_depver}
Obsoletes: %{name}-test-devel < %{samba_depver}
%description test-libs
%{name}-test-libs provides libraries required by the testing tools.
### WINBIND
%package winbind
Summary: Samba winbind
Group: Applications/System
Requires(pre): %{name}-common = %{samba_depver}
Requires: %{name}-common-libs = %{samba_depver}
Requires: %{name}-common-tools = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Requires: %{name}-winbind-modules = %{samba_depver}
Provides: samba4-winbind = %{samba_depver}
Obsoletes: samba4-winbind < %{samba_depver}
%description winbind
The samba-winbind package provides the winbind NSS library, and some
client tools. Winbind enables Linux to be a full member in Windows
domains and to use Windows user and group accounts on Linux.
### WINBIND-CLIENTS
%package winbind-clients
Summary: Samba winbind clients
Group: Applications/System
Requires: %{name}-common = %{samba_depver}
Requires: %{name}-common-libs = %{samba_depver}
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
Requires: %{name}-winbind = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
Provides: samba4-winbind-clients = %{samba_depver}
Obsoletes: samba4-winbind-clients < %{samba_depver}
%description winbind-clients
The samba-winbind-clients package provides the wbinfo and ntlm_auth
tool.
### WINBIND-KRB5-LOCATOR
%package winbind-krb5-locator
Summary: Samba winbind krb5 locator
Group: Applications/System
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
Requires: %{name}-winbind = %{samba_depver}
%else
Requires: %{name}-libs = %{samba_depver}
%endif
Provides: samba4-winbind-krb5-locator = %{samba_depver}
Obsoletes: samba4-winbind-krb5-locator < %{samba_depver}
# Handle winbind_krb5_locator.so as alternatives to allow
# IPA AD trusts case where it should not be used by libkrb5
# The plugin will be diverted to /dev/null by the FreeIPA
# freeipa-server-trust-ad subpackage due to higher priority
# and restored to the proper one on uninstall
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
%description winbind-krb5-locator
The winbind krb5 locator is a plugin for the system kerberos library to allow
the local kerberos library to use the same KDC as samba and winbind use
### WINBIND-MODULES
%package winbind-modules
Summary: Samba winbind modules
Group: Applications/System
Requires: %{name}-client-libs = %{samba_depver}
Requires: %{name}-libs = %{samba_depver}
%if %with_libwbclient
Requires: libwbclient = %{samba_depver}
%endif
Requires: pam
%description winbind-modules
The samba-winbind-modules package provides the NSS library and a PAM
module necessary to communicate to the Winbind Daemon
### CTDB
%if %with_clustering_support
%package -n ctdb
Summary: A Clustered Database based on Samba's Trivial Database (TDB)
Group: System Environment/Daemons
Requires: %{name}-client-libs = %{samba_depver}
Requires: coreutils
Requires: fileutils
# for ps and killall
Requires: psmisc
Requires: sed
%if ! %{with_internal_tdb}
Requires: tdb-tools
%endif
Requires: gawk
# for pkill and pidof:
Requires: procps-ng
# for netstat:
Requires: net-tools
Requires: ethtool
# for ip:
Requires: iproute
Requires: iptables
# for flock, getopt, kill:
Requires: util-linux
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description -n ctdb
CTDB is a cluster implementation of the TDB database used by Samba and other
projects to store temporary data. If an application is already using TDB for
temporary data it is very easy to convert that application to be cluster aware
and use CTDB instead.
### CTDB-TEST
%package -n ctdb-tests
Summary: CTDB clustered database test suite
Group: Development/Tools
Requires: samba-client-libs = %{samba_depver}
Requires: ctdb = %{samba_depver}
Requires: nc
Provides: ctdb-devel = %{samba_depver}
Obsoletes: ctdb-devel < %{samba_depver}
%description -n ctdb-tests
Test suite for CTDB.
CTDB is a cluster implementation of the TDB database used by Samba and other
projects to store temporary data. If an application is already using TDB for
temporary data it is very easy to convert that application to be cluster aware
and use CTDB instead.
%endif # with_clustering_support
%prep
%setup -D -q -n samba-%{version}%{pre_release}
%build
%global _talloc_lib ,talloc,pytalloc,pytalloc-util
%global _tevent_lib ,tevent,pytevent
%global _tdb_lib ,tdb,pytdb
%global _ldb_lib ,ldb,pyldb,pyldb-util
%if ! %{with_internal_talloc}
%global _talloc_lib ,!talloc,!pytalloc,!pytalloc-util
%endif
%if ! %{with_internal_tevent}
%global _tevent_lib ,!tevent,!pytevent
%endif
%if ! %{with_internal_tdb}
%global _tdb_lib ,!tdb,!pytdb
%endif
%if ! %{with_internal_ldb}
%global _ldb_lib ,!ldb,!pyldb,!pyldb-util
%endif
%global _samba4_libraries heimdal,!zlib,!popt%{_talloc_lib}%{_tevent_lib}%{_tdb_lib}%{_ldb_lib}
%global _samba4_idmap_modules idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
%global _samba4_pdb_modules pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
%global _samba4_auth_modules auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
%global _samba4_modules %{_samba4_idmap_modules},%{_samba4_pdb_modules},%{_samba4_auth_modules}
%global _libsmbclient %nil
%global _libwbclient %nil
%if ! %with_libsmbclient
%global _libsmbclient smbclient,
%endif
%if ! %with_libwbclient
%global _libwbclient wbclient,
%endif
%global _samba4_private_libraries %{_libsmbclient}%{_libwbclient}
%if %{with configure}
%configure \
--enable-fhs \
--with-piddir=/run \
--with-sockets-dir=/run/samba \
--with-modulesdir=%{_libdir}/samba \
--with-pammodulesdir=%{_libdir}/security \
--with-lockdir=/var/lib/samba/lock \
--with-statedir=/var/lib/samba \
--with-cachedir=/var/lib/samba \
--disable-rpath-install \
--with-shared-modules=%{_samba4_modules} \
--bundled-libraries=%{_samba4_libraries} \
--with-pam \
--with-pie \
--with-relro \
--without-fam \
%if (! %with_libsmbclient) || (! %with_libwbclient)
--private-libraries=%{_samba4_private_libraries} \
%endif
%if %with_mitkrb5
--with-system-mitkrb5 \
%endif
%if ! %with_dc
--without-ad-dc \
%endif
%if ! %with_vfs_glusterfs
--disable-glusterfs \
%endif
%if %with_clustering_support
--with-cluster-support \
%endif
%if %with_profiling
--with-profiling-data \
%endif
%if %{with testsuite}
--enable-selftest \
%endif
--with-systemd
%endif
make %{?_smp_mflags}
%install
make %{?_smp_mflags} install DESTDIR=%{buildroot}
install -d -m 0755 %{buildroot}/usr/{sbin,bin}
install -d -m 0755 %{buildroot}%{_libdir}/security
install -d -m 0755 %{buildroot}/var/lib/samba
install -d -m 0755 %{buildroot}/var/lib/samba/private
install -d -m 0755 %{buildroot}/var/lib/samba/winbindd_privileged
install -d -m 0755 %{buildroot}/var/lib/samba/scripts
install -d -m 0755 %{buildroot}/var/lib/samba/sysvol
install -d -m 0755 %{buildroot}/var/log/samba/old
install -d -m 0755 %{buildroot}/var/spool/samba
install -d -m 0755 %{buildroot}/var/run/samba
install -d -m 0755 %{buildroot}/var/run/winbindd
install -d -m 0755 %{buildroot}/%{_libdir}/samba
install -d -m 0755 %{buildroot}/%{_libdir}/pkgconfig
# Move libwbclient.so* into private directory, it cannot be just libdir/samba
# because samba uses rpath with this directory.
install -d -m 0755 %{buildroot}/%{_libdir}/samba/wbclient
mv %{buildroot}/%{_libdir}/libwbclient.so* %{buildroot}/%{_libdir}/samba/wbclient
if [ ! -f %{buildroot}/%{_libdir}/samba/wbclient/libwbclient.so.%{libwbc_alternatives_version} ]
then
echo "Expected libwbclient version not found, please check if version has changed."
exit -1
fi
touch %{buildroot}%{_libexecdir}/samba/cups_backend_smb
# Install other stuff
install -d -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/samba
install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/samba/smb.conf
install -d -m 0755 %{buildroot}%{_sysconfdir}/security
install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/security/pam_winbind.conf
install -d -m 0755 %{buildroot}%{_sysconfdir}/pam.d
install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/pam.d/samba
echo 127.0.0.1 localhost > %{buildroot}%{_sysconfdir}/samba/lmhosts
# openLDAP database schema
install -d -m 0755 %{buildroot}%{_sysconfdir}/openldap/schema
install -m644 examples/LDAP/samba.schema %{buildroot}%{_sysconfdir}/openldap/schema/samba.schema
install -m 0744 packaging/printing/smbprint %{buildroot}%{_bindir}/smbprint
install -d -m 0755 %{buildroot}%{_prefix}/lib/tmpfiles.d/
install -m644 packaging/systemd/samba.conf.tmp %{buildroot}%{_prefix}/lib/tmpfiles.d/samba.conf
# create /run/samba too.
echo "d /run/samba 755 root root" >> %{buildroot}%{_prefix}/lib/tmpfiles.d/samba.conf
%if %with_clustering_support
echo "d /run/ctdb 755 root root" >> %{buildroot}%{_tmpfilesdir}/ctdb.conf
%endif
install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
install -m 0644 packaging/systemd/samba.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/samba
%if %with_clustering_support
install -m 0644 ctdb/config/ctdb.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/ctdb
%endif
install -m 0644 %{SOURCE201} packaging/README.downgrade
%if ! %with_dc
install -m 0644 %{SOURCE200} packaging/README.dc
install -m 0644 %{SOURCE200} packaging/README.dc-libs
%endif
install -d -m 0755 %{buildroot}%{_unitdir}
for i in nmb smb winbind ; do
cat packaging/systemd/$i.service | sed -e 's@\[Service\]@[Service]\nEnvironment=KRB5CCNAME=FILE:/run/samba/krb5cc_samba@g' >tmp$i.service
install -m 0644 tmp$i.service %{buildroot}%{_unitdir}/$i.service
done
%if %with_clustering_support
install -m 0755 ctdb/config/ctdb.service %{buildroot}%{_unitdir}
%endif
# NetworkManager online/offline script
install -d -m 0755 %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/
install -m 0755 packaging/NetworkManager/30-winbind-systemd \
%{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/30-winbind
# winbind krb5 locator
install -d -m 0755 %{buildroot}%{_libdir}/krb5/plugins/libkrb5
touch %{buildroot}%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
%if ! %with_dc
for i in %{_libdir}/samba/libdfs-server-ad-samba4.so \
%{_libdir}/samba/libdnsserver-common-samba4.so \
%{_mandir}/man8/samba.8 \
%{_mandir}/man8/samba-tool.8 \
%{_libdir}/samba/ldb/ildap.so \
%{_libdir}/samba/ldb/ldbsamba_extensions.so ; do
rm -f %{buildroot}$i
done
%endif
# This makes the right links, as rpmlint requires that
# the ldconfig-created links be recorded in the RPM.
/sbin/ldconfig -N -n %{buildroot}%{_libdir}
%if %{with testsuite}
%check
TDB_NO_FSYNC=1 make %{?_smp_mflags} test
%endif
%post
%systemd_post smb.service
%systemd_post nmb.service
%preun
%systemd_preun smb.service
%systemd_preun nmb.service
%postun
%systemd_postun_with_restart smb.service
%systemd_postun_with_restart nmb.service
%post common
/sbin/ldconfig
/usr/bin/systemd-tmpfiles --create %{_prefix}/lib/tmpfiles.d/samba.conf
if [ -d /var/cache/samba ]; then
mv /var/cache/samba/netsamlogon_cache.tdb /var/lib/samba/ 2>/dev/null
mv /var/cache/samba/winbindd_cache.tdb /var/lib/samba/ 2>/dev/null
rm -rf /var/cache/samba/
ln -sf /var/cache/samba /var/lib/samba/
fi
%post client
%{_sbindir}/update-alternatives --install %{_libexecdir}/samba/cups_backend_smb \
cups_backend_smb \
%{_bindir}/smbspool 10
%postun client
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove cups_backend_smb %{_libexecdir}/samba/smbspool
fi
%post client-libs -p /sbin/ldconfig
%postun client-libs -p /sbin/ldconfig
%post common-libs -p /sbin/ldconfig
%postun common-libs -p /sbin/ldconfig
%if %with_dc
%post dc-libs -p /sbin/ldconfig
%postun dc-libs -p /sbin/ldconfig
%endif
%post krb5-printing
%{_sbindir}/update-alternatives --install %{_libexecdir}/samba/cups_backend_smb \
cups_backend_smb \
%{_libexecdir}/samba/smbspool_krb5_wrapper 50
%postun krb5-printing
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove cups_backend_smb %{_libexecdir}/samba/smbspool_krb5_wrapper
fi
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%if %with_libsmbclient
%post -n libsmbclient -p /sbin/ldconfig
%postun -n libsmbclient -p /sbin/ldconfig
%endif
%if %with_libwbclient
%posttrans -n libwbclient
# It has to be posttrans here to make sure all files of a previous version
# without alternatives support are removed
%{_sbindir}/update-alternatives --install %{_libdir}/libwbclient.so.%{libwbc_alternatives_version} \
libwbclient.so.%{libwbc_alternatives_version}%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so.%{libwbc_alternatives_version} 10
/sbin/ldconfig
%preun -n libwbclient
%{_sbindir}/update-alternatives --remove libwbclient.so.%{libwbc_alternatives_version}%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so.%{libwbc_alternatives_version}
/sbin/ldconfig
%posttrans -n libwbclient-devel
%{_sbindir}/update-alternatives --install %{_libdir}/libwbclient.so \
libwbclient.so%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so 10
%preun -n libwbclient-devel
# alternatives checks if the file which should be removed is a link or not, but
# not if it points to the /etc/alternatives directory or to some other place.
# When downgrading to a version where alternatives is not used and
# libwbclient.so is a link and not a file it will be removed. The following
# check removes the alternatives files manually if that is the case.
if [ "`readlink %{_libdir}/libwbclient.so`" == "libwbclient.so.%{libwbc_alternatives_version}" ]; then
/bin/rm -f /etc/alternatives/libwbclient.so%{libwbc_alternatives_suffix} /var/lib/alternatives/libwbclient.so%{libwbc_alternatives_suffix} 2> /dev/null
else
%{_sbindir}/update-alternatives --remove libwbclient.so%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so
fi
%endif # with_libwbclient
%post test -p /sbin/ldconfig
%postun test -p /sbin/ldconfig
%pre winbind
/usr/sbin/groupadd -g 88 wbpriv >/dev/null 2>&1 || :
%post winbind
%systemd_post winbind.service
%preun winbind
%systemd_preun winbind.service
%postun winbind
%systemd_postun_with_restart smb.service
%systemd_postun_with_restart nmb.service
%postun winbind-krb5-locator
if [ "$1" -ge "1" ]; then
if [ "`readlink %{_sysconfdir}/alternatives/winbind_krb5_locator.so`" == "%{_libdir}/winbind_krb5_locator.so" ]; then
%{_sbindir}/update-alternatives --set winbind_krb5_locator.so %{_libdir}/winbind_krb5_locator.so
fi
fi