File cifs-utils.spec of Package cifs-utils.10545

# spec file for package cifs-utils
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           cifs-utils
Version:        6.8
Release:        0
Summary:        Utilities for doing and managing mounts of the Linux CIFS filesystem
License:        GPL-3.0-or-later
Group:          System/Filesystems
# origin   git://
# for-next
Source6:        cifs-utils.keyring
Source100:      README.cifstab.migration
Source1:        cifs.init

Patch0:         0001-docs-cleanup-rst-formating.patch
Patch1:         0002-mount.cifs.rst-document-new-no-handlecache-mount-opt.patch
Patch2:         0003-manpage-update-mount.cifs-manpage-with-info-about-rd.patch
Patch3:         0004-checkopts-add-python-script-to-cross-check-mount-opt.patch
Patch4:         0005-mount.cifs.rst-document-missing-options-correct-wron.patch
Patch5:         0006-cifs-utils-support-rst2man-3.patch
Patch6:         0007-checkopts-report-duplicated-options-in-man-page.patch
Patch7:         0008-mount.cifs.rst-more-cleanups.patch
Patch8:         0009-mount.cifs.rst-document-vers-3-mount-option.patch
Patch9:         0010-mount.cifs.rst-document-vers-3.02-mount-option.patch
Patch10:        suse-document-new-vers-default-SMB2.1.patch
Patch11:        allow-dns-resolver-key-to-expire.patch

# cifs-utils 6.8 switched to python for man page generation
# we need to require either py2 or py3 package
# some products do not have a py2/py3 versions
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150000
BuildRequires:  python3-docutils
BuildRequires:  python-docutils

%if 0%{?suse_version} >= 1221
%define systemd 1
%define systemd 0

%if 0%{?suse_version} < 1221
PreReq:         insserv %{?fillup_prereq}
%define         initdir %{_sysconfdir}/init.d
Provides:       cifs-mount = %{version}
Obsoletes:      cifs-mount < %{version}
%if 0%{?suse_version} > 1140
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  keyutils-devel
BuildRequires:  krb5-devel
%if 0%{?suse_version} > 1120
BuildRequires:  libcap-ng-devel
BuildRequires:  libcap-devel
#!BuildIgnore:  samba-client
BuildRequires:  libtalloc-devel
%if 0%{?suse_version} > 1110
BuildRequires:  fdupes
BuildRequires:  libwbclient-devel
BuildRequires:  pam-devel
BuildRequires:  pkg-config
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} >= 150000
BuildRequires:  (samba-libs-python3 if samba-libs >= 4.9.3)
BuildRequires:  samba-libs-python3
Requires:       keyutils
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run

The cifs-utils package consist of utilities for doing and managing mounts of
the Linux CIFS filesystem.

%package devel
Summary:        Files needed for building plugins for cifs-utils
Group:          Development/Libraries

%description devel
The SMB/CIFS protocol is a standard file sharing protocol widely deployed
on Microsoft Windows machines. This package contains the header file
necessary for building ID mapping plugins for cifs-utils.

%package -n pam_cifscreds
Summary:        PAM module to manage NTLM credentials in kernel keyring
Group:          System/Libraries

%description -n pam_cifscreds
The pam_cifscreds PAM module is a tool for automatically adding
credentials (username and password) for the purpose of establishing
sessions in multiuser mounts.

When a cifs filesystem is mounted with the "multiuser" option, and does
not use krb5 authentication, it needs to be able to get the credentials
for each user from somewhere. The pam_cifscreds module can be used to
provide these credentials to the kernel automatically at login.

%setup -q
cp -a ${RPM_SOURCE_DIR}/README.cifstab.migration .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1

export CFLAGS="%{optflags} -D_GNU_SOURCE -fpie"
export LDFLAGS="-pie"
autoreconf -i
%configure \
make %{?_smp_mflags}

%if ! %{systemd}
mkdir -p %{buildroot}/%{_sysconfdir}/init.d

mkdir -p %{buildroot}%{_sysconfdir}/%{name}
ln -s %{_libdir}/%{name}/ %{buildroot}%{_sysconfdir}/%{name}/idmap-plugin
mkdir -p %{buildroot}%{_sysconfdir}/request-key.d
install -m 644 -p contrib/request-key.d/cifs.idmap.conf %{buildroot}%{_sysconfdir}/request-key.d
install -m 644 -p contrib/request-key.d/cifs.spnego.conf %{buildroot}%{_sysconfdir}/request-key.d
%if 0%{?suse_version} > 1221
mkdir -p \
	%{buildroot}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d \
	%{buildroot}/%{_sysconfdir}/samba \
	%{buildroot}/%{_sbindir} \

%if ! %{systemd}
install -m 0755 -p ${RPM_SOURCE_DIR}/cifs.init %{buildroot}/%{_sysconfdir}/init.d/cifs
ln -s service %{buildroot}/%{_sbindir}/rccifs

touch %{buildroot}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d/${script} \
# Hardlink duplicate files
%if 0%{?suse_version} > 1110
%fdupes %{buildroot}

%dir %{_sysconfdir}/request-key.d
%config(noreplace) %{_sysconfdir}/request-key.d/cifs.idmap.conf
%config(noreplace) %{_sysconfdir}/request-key.d/cifs.spnego.conf
%dir %{_libdir}/cifs-utils
%dir %{_sysconfdir}/cifs-utils
%config(noreplace) %{_sysconfdir}/cifs-utils/idmap-plugin
%if 0%{?suse_version} > 1221
%if ! %{systemd}
%attr(0754,root,root) %config %{_sysconfdir}/init.d/cifs
%dir %{_sysconfdir}/samba
%ghost %{_rundir}/cifs
%doc README.cifstab.migration

%files devel

%files -n pam_cifscreds

openSUSE Build Service is sponsored by