nfs-utils-1.3.4.ebuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.4
  22. net-libs/libtirpc:=
  23. libmount? ( sys-apps/util-linux )
  24. nfsdcld? ( >=dev-db/sqlite-3.3 )
  25. nfsv4? (
  26. dev-libs/libevent:=
  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. epatch_user
  58. eautoreconf
  59. }
  60. src_configure() {
  61. export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
  62. export ac_cv_header_keyutils_h=$(usex nfsidmap)
  63. econf \
  64. --with-statedir="${EPREFIX}"/var/lib/nfs \
  65. --enable-tirpc \
  66. --with-tirpcinclude="${EPREFIX}"/usr/include/tirpc/ \
  67. $(use_enable libmount libmount-mount) \
  68. $(use_with tcpd tcp-wrappers) \
  69. $(use_enable nfsdcld nfsdcltrack) \
  70. $(use_enable nfsv4) \
  71. $(use_enable nfsv41) \
  72. $(use_enable ipv6) \
  73. $(use_enable caps) \
  74. $(use_enable uuid) \
  75. $(use_enable kerberos gss) \
  76. --without-gssglue
  77. }
  78. src_compile(){
  79. # remove compiled files bundled in the tarball
  80. emake clean
  81. default
  82. }
  83. src_install() {
  84. default
  85. rm linux-nfs/Makefile* || die
  86. dodoc -r linux-nfs README
  87. # Don't overwrite existing xtab/etab, install the original
  88. # versions somewhere safe... more info in pkg_postinst
  89. keepdir /var/lib/nfs/{,sm,sm.bak}
  90. mv "${ED}"/var/lib "${ED}"/usr/$(get_libdir) || die
  91. # Install some client-side binaries in /sbin
  92. dodir /sbin
  93. mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
  94. if use nfsv4 && use nfsidmap ; then
  95. # Install a config file for idmappers in newer kernels. #415625
  96. insinto /etc/request-key.d
  97. echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
  98. doins id_resolver.conf
  99. fi
  100. insinto /etc
  101. doins "${FILESDIR}"/exports
  102. keepdir /etc/exports.d
  103. local f list=() opt_need=""
  104. if use nfsv4 ; then
  105. opt_need="rpc.idmapd"
  106. list+=( rpc.idmapd rpc.pipefs )
  107. use kerberos && list+=( rpc.gssd rpc.svcgssd )
  108. fi
  109. for f in nfs nfsclient rpc.statd "${list[@]}" ; do
  110. newinitd "${FILESDIR}"/${f}.initd ${f}
  111. done
  112. newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 2015/08/01
  113. for f in nfs nfsclient ; do
  114. newconfd "${FILESDIR}"/${f}.confd ${f}
  115. done
  116. sed -i \
  117. -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
  118. "${ED}"/etc/conf.d/nfs || die #234132
  119. systemd_dounit systemd/*.{mount,service,target}
  120. if ! use nfsv4 || ! use kerberos ; then
  121. rm "${D}$(systemd_get_unitdir)"/rpc-{gssd,svcgssd}.service || die
  122. fi
  123. if ! use nfsv41 ; then
  124. rm "${D}$(systemd_get_unitdir)"/nfs-blkmap.* || die
  125. fi
  126. rm "${D}$(systemd_get_unitdir)"/nfs-config.service || die
  127. sed -i -r \
  128. -e "/^EnvironmentFile=/s:=.*:=${EPREFIX}/etc/conf.d/nfs:" \
  129. -e '/^(After|Wants)=nfs-config.service$/d' \
  130. -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
  131. "${D}$(systemd_get_unitdir)"/* || die
  132. }
  133. pkg_postinst() {
  134. # Install default xtab and friends if there's none existing. In
  135. # src_install we put them in /usr/lib/nfs for safe-keeping, but
  136. # the daemons actually use the files in /var/lib/nfs. #30486
  137. local f
  138. mkdir -p "${EROOT}"/var/lib/nfs #368505
  139. for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
  140. [[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
  141. einfo "Copying default ${f##*/} from ${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
  142. cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
  143. done
  144. if systemd_is_booted; then
  145. if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
  146. ewarn "We have switched to upstream systemd unit files. Since"
  147. ewarn "they got renamed, you should probably enable the new ones."
  148. ewarn "You can run 'equery files nfs-utils | grep systemd'"
  149. ewarn "to know what services you need to enable now."
  150. fi
  151. else
  152. ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
  153. ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
  154. ewarn "same runlevel as nfsmount."
  155. fi
  156. }