nfs-utils-1.3.1-r5.ebuild 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils flag-o-matic multilib autotools systemd
  5. DESCRIPTION="NFS client and server daemons"
  6. HOMEPAGE="http://linux-nfs.org/"
  7. SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
  11. IUSE="caps ipv6 kerberos +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux tcpd +uuid"
  12. REQUIRED_USE="kerberos? ( nfsv4 )"
  13. RESTRICT="test" #315573
  14. # kth-krb doesn't provide the right include
  15. # files, and nfs-utils doesn't build against heimdal either,
  16. # so don't depend on virtual/krb.
  17. # (04 Feb 2005 agriffis)
  18. DEPEND_COMMON="tcpd? ( sys-apps/tcp-wrappers )
  19. caps? ( sys-libs/libcap )
  20. sys-libs/e2fsprogs-libs
  21. >=net-nds/rpcbind-0.2.0-r1
  22. net-libs/libtirpc
  23. libmount? ( sys-apps/util-linux )
  24. nfsdcld? ( >=dev-db/sqlite-3.3 )
  25. nfsv4? (
  26. <=dev-libs/libevent-2.1
  27. >=net-libs/libnfsidmap-0.21-r1
  28. kerberos? (
  29. >=net-libs/libtirpc-0.2.4-r1[kerberos]
  30. app-crypt/mit-krb5
  31. )
  32. nfsidmap? (
  33. >=net-libs/libnfsidmap-0.24
  34. >=sys-apps/keyutils-1.5.9
  35. )
  36. )
  37. nfsv41? (
  38. sys-fs/lvm2
  39. )
  40. uuid? ( sys-apps/util-linux )"
  41. RDEPEND="${DEPEND_COMMON}
  42. !net-nds/portmap
  43. !<sys-apps/openrc-0.13.9
  44. selinux? (
  45. sec-policy/selinux-rpc
  46. sec-policy/selinux-rpcbind
  47. )
  48. "
  49. DEPEND="${DEPEND_COMMON}
  50. virtual/pkgconfig"
  51. src_prepare() {
  52. epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
  53. epatch "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
  54. sed \
  55. -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
  56. -i utils/*/Makefile.am || die
  57. eautoreconf
  58. }
  59. src_configure() {
  60. export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
  61. export ac_cv_header_keyutils_h=$(usex nfsidmap)
  62. econf \
  63. --with-statedir="${EPREFIX}"/var/lib/nfs \
  64. --enable-tirpc \
  65. --with-tirpcinclude="${EPREFIX}"/usr/include/tirpc/ \
  66. $(use_enable libmount libmount-mount) \
  67. $(use_with tcpd tcp-wrappers) \
  68. $(use_enable nfsdcld nfsdcltrack) \
  69. $(use_enable nfsv4) \
  70. $(use_enable nfsv41) \
  71. $(use_enable ipv6) \
  72. $(use_enable caps) \
  73. $(use_enable uuid) \
  74. $(use_enable kerberos gss) \
  75. --without-gssglue
  76. }
  77. src_compile(){
  78. # remove compiled files bundled in the tarball
  79. emake clean
  80. default
  81. }
  82. src_install() {
  83. default
  84. rm linux-nfs/Makefile* || die
  85. dodoc -r linux-nfs README
  86. # Don't overwrite existing xtab/etab, install the original
  87. # versions somewhere safe... more info in pkg_postinst
  88. keepdir /var/lib/nfs/{,sm,sm.bak}
  89. mv "${ED}"/var/lib "${ED}"/usr/$(get_libdir) || die
  90. # Install some client-side binaries in /sbin
  91. dodir /sbin
  92. mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
  93. if use nfsv4 && use nfsidmap ; then
  94. # Install a config file for idmappers in newer kernels. #415625
  95. insinto /etc/request-key.d
  96. echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
  97. doins id_resolver.conf
  98. fi
  99. insinto /etc
  100. doins "${FILESDIR}"/exports
  101. keepdir /etc/exports.d
  102. local f list=() opt_need=""
  103. if use nfsv4 ; then
  104. opt_need="rpc.idmapd"
  105. list+=( rpc.idmapd rpc.pipefs )
  106. use kerberos && list+=( rpc.gssd rpc.svcgssd )
  107. fi
  108. for f in nfs nfsclient rpc.statd "${list[@]}" ; do
  109. newinitd "${FILESDIR}"/${f}.initd ${f}
  110. done
  111. newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 2015/08/01
  112. for f in nfs nfsclient ; do
  113. newconfd "${FILESDIR}"/${f}.confd ${f}
  114. done
  115. sed -i \
  116. -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
  117. "${ED}"/etc/conf.d/nfs || die #234132
  118. systemd_dounit systemd/*.{mount,service,target}
  119. if ! use nfsv4 || ! use kerberos ; then
  120. rm "${D}$(systemd_get_unitdir)"/rpc-{gssd,svcgssd}.service || die
  121. fi
  122. rm "${D}$(systemd_get_unitdir)"/nfs-config.service || die
  123. sed -i -r \
  124. -e "/^EnvironmentFile=/s:=.*:=${EPREFIX}/etc/conf.d/nfs:" \
  125. -e '/^(After|Wants)=nfs-config.service$/d' \
  126. -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
  127. "${D}$(systemd_get_unitdir)"/* || die
  128. }
  129. pkg_postinst() {
  130. # Install default xtab and friends if there's none existing. In
  131. # src_install we put them in /usr/lib/nfs for safe-keeping, but
  132. # the daemons actually use the files in /var/lib/nfs. #30486
  133. local f
  134. mkdir -p "${EROOT}"/var/lib/nfs #368505
  135. for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
  136. [[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
  137. einfo "Copying default ${f##*/} from ${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
  138. cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
  139. done
  140. if systemd_is_booted; then
  141. if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
  142. ewarn "We have switched to upstream systemd unit files. Since"
  143. ewarn "they got renamed, you should probably enable the new ones."
  144. ewarn "You can run 'equery files nfs-utils | grep systemd'"
  145. ewarn "to know what services you need to enable now."
  146. fi
  147. else
  148. ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
  149. ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
  150. ewarn "same runlevel as nfsmount."
  151. fi
  152. }