net-fs/nfs-utils: add metadata to cross-compile patch
[gentoo.git] / net-fs / cifs-utils / cifs-utils-6.7.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools eutils linux-info multilib pam
7
8 DESCRIPTION="Tools for Managing Linux CIFS Client Filesystems"
9 HOMEPAGE="https://wiki.samba.org/index.php/LinuxCIFS_utils"
10 SRC_URI="https://ftp.samba.org/pub/linux-cifs/${PN}/${P}.tar.bz2"
11
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-linux"
15 IUSE="+acl +ads +caps +caps-ng creds pam"
16
17 RDEPEND="
18         !net-fs/mount-cifs
19         !<net-fs/samba-3.6_rc1
20         sys-apps/keyutils
21         ads? (
22                 sys-libs/talloc
23                 virtual/krb5
24         )
25         caps? ( !caps-ng? ( sys-libs/libcap ) )
26         caps? ( caps-ng? ( sys-libs/libcap-ng ) )
27         pam? ( sys-libs/pam )
28 "
29 DEPEND="${RDEPEND}"
30 PDEPEND="
31         acl? ( >=net-fs/samba-4.0.0_alpha1 )
32 "
33
34 REQUIRED_USE="acl? ( ads )"
35
36 DOCS="doc/linux-cifs-client-guide.odt"
37
38 PATCHES=(
39         "${FILESDIR}/${P}-talloc.patch"
40 )
41
42 pkg_setup() {
43         linux-info_pkg_setup
44
45         if ! linux_config_exists || ! linux_chkconfig_present CIFS; then
46                 ewarn "You must enable CIFS support in your kernel config, "
47                 ewarn "to be able to mount samba shares. You can find it at"
48                 ewarn
49                 ewarn "  File systems"
50                 ewarn " Network File Systems"
51                 ewarn "                 CIFS support"
52                 ewarn
53                 ewarn "and recompile your kernel ..."
54         fi
55 }
56
57 src_prepare() {
58         default
59
60         if has_version app-crypt/heimdal ; then
61                 # https://bugs.gentoo.org/612584
62                 eapply "${FILESDIR}/${PN}-6.7-heimdal.patch"
63         fi
64
65         eautoreconf
66 }
67
68 src_configure() {
69         ROOTSBINDIR="${EPREFIX}"/sbin \
70         econf \
71                 $(use_enable acl cifsacl cifsidmap) \
72                 $(use_enable ads cifsupcall) \
73                 $(use caps && use_with !caps-ng libcap || echo --without-libcap) \
74                 $(use caps && use_with caps-ng libcap-ng || echo --without-libcap-ng) \
75                 $(use_enable creds cifscreds) \
76                 $(use_enable pam) \
77                 $(use_with pam pamdir $(getpam_mod_dir))
78 }
79
80 src_install() {
81         default
82
83         # remove empty directories
84         find "${ED}" -type d -print0 | xargs --null rmdir \
85                 --ignore-fail-on-non-empty &>/dev/null
86
87         if use acl ; then
88                 dodir /etc/cifs-utils
89                 dosym /usr/$(get_libdir)/cifs-utils/idmapwb.so \
90                         /etc/cifs-utils/idmap-plugin
91                 dodir /etc/request-key.d
92                 echo 'create cifs.idmap * * /usr/sbin/cifs.idmap %k' \
93                         > "${ED}/etc/request-key.d/cifs.idmap.conf"
94         fi
95
96         if use ads ; then
97                 dodir /etc/request-key.d
98                 echo 'create dns_resolver * * /usr/sbin/cifs.upcall %k' \
99                         > "${ED}/etc/request-key.d/cifs.upcall.conf"
100                 echo 'create cifs.spnego * * /usr/sbin/cifs.upcall %k' \
101                         > "${ED}/etc/request-key.d/cifs.spnego.conf"
102         fi
103 }
104
105 pkg_postinst() {
106         # Inform about set-user-ID bit of mount.cifs
107         ewarn "setuid use flag was dropped due to multiple security implications"
108         ewarn "such as CVE-2009-2948, CVE-2011-3585 and CVE-2012-1586"
109         ewarn "You are free to set setuid flags by yourself"
110
111         # Inform about upcall usage
112         if use acl ; then
113                 einfo "The cifs.idmap utility has been enabled by creating the"
114                 einfo "configuration file /etc/request-key.d/cifs.idmap.conf"
115                 einfo "This enables you to get and set CIFS acls."
116         fi
117
118         if use ads ; then
119                 einfo "The cifs.upcall utility has been enabled by creating the"
120                 einfo "configuration file /etc/request-key.d/cifs.upcall.conf"
121                 einfo "This enables you to mount DFS shares."
122         fi
123 }