Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--- orig/samba.spec.4.3.4-1.orig 2016-01-25 09:46:10.533151047 -0600
+++ samba.spec 2016-01-29 07:39:38.291768866 -0600
@@ -3,6 +3,7 @@
# The testsuite is disabled by default. Set --with testsuite or %bcond_without
# to run the Samba torture testsuite.
%bcond_with testsuite
+%bcond_with dc
# ctdb is enabled by default, you can disable it with: --without clustering
%bcond_without clustering
@@ -60,7 +61,7 @@
%global with_mitkrb5 1
%global with_dc 0
-%if %{with testsuite}
+%if %{with testsuite} || %{with dc}
# The testsuite only works with a full build right now.
%global with_mitkrb5 0
%global with_dc 1
@@ -77,12 +78,7 @@
Name: samba
Version: %{samba_version}
Release: %{samba_release}
-
-%if 0%{?rhel}
-Epoch: 0
-%else
-Epoch: 2
-%endif
+Epoch: 4
%if 0%{?epoch} > 0
%define samba_depver %{epoch}:%{version}-%{release}
@@ -107,6 +103,7 @@
Source200: README.dc
Source201: README.downgrade
+Patch0: samba-4.1.12-unit.patch
Patch1: samba-4.3-s3-parm-clean-up-defaults-when-removing-global-param.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@@ -312,6 +309,13 @@
Provides: samba4-dc = %{samba_depver}
Obsoletes: samba4-dc < %{samba_depver}
+%if %with_dc
+Requires: tdb-tools >= %{libtdb_version}
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+%endif
+
%description dc
The samba-dc package provides AD Domain Controller functionality
@@ -672,6 +676,7 @@
%prep
%setup -q -n samba-%{version}%{pre_release}
+%patch0 -p1
%patch1 -p1
%build
@@ -831,7 +836,7 @@
%endif
install -d -m 0755 %{buildroot}%{_unitdir}
-for i in nmb smb winbind ; do
+for i in nmb smb winbind %{?with_dc:samba} ; 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
@@ -885,6 +890,18 @@
%post dc-libs -p /sbin/ldconfig
%postun dc-libs -p /sbin/ldconfig
+
+%post dc
+%systemd_post samba.service
+mkdir -p %{_libdir}/ldb/modules/ldb/samba
+ln -sf %{_libdir}/samba/ldb %{_libdir}/ldb/modules/ldb/samba
+
+%preun dc
+%systemd_preun samba.service
+
+%postun dc
+%systemd_postun_with_restart samba.service
+rm -f %{_libdir}/ldb/modules/ldb/samba
%endif # with_dc
%post libs -p /sbin/ldconfig
@@ -1427,6 +1444,7 @@
%{_datadir}/samba/setup
%{_mandir}/man8/samba.8*
%{_mandir}/man8/samba-tool.8*
+%{_unitdir}/samba.service
%else # with_dc
%doc packaging/README.dc
%exclude %{_mandir}/man8/samba.8*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.