zfs-0.6.2-r5.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python{2_7,3_4} )
  5. inherit python-r1
  6. AT_M4DIR="config"
  7. AUTOTOOLS_AUTORECONF="1"
  8. AUTOTOOLS_IN_SOURCE_BUILD="1"
  9. if [ ${PV} == "9999" ] ; then
  10. inherit git-2 linux-mod
  11. EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
  12. else
  13. inherit eutils versionator
  14. MY_PV=$(replace_version_separator 3 '-')
  15. SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
  16. https://dev.gentoo.org/~ryao/dist/${PN}-kmod-${MY_PV}-p4.tar.xz"
  17. S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
  18. KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
  19. fi
  20. inherit bash-completion-r1 flag-o-matic toolchain-funcs autotools-utils udev systemd
  21. DESCRIPTION="Userland utilities for ZFS Linux kernel module"
  22. HOMEPAGE="http://zfsonlinux.org/"
  23. LICENSE="BSD-2 CDDL bash-completion? ( MIT )"
  24. SLOT="0"
  25. IUSE="bash-completion custom-cflags debug kernel-builtin +rootfs selinux test-suite static-libs"
  26. RESTRICT="test"
  27. COMMON_DEPEND="
  28. selinux? ( sys-libs/libselinux )
  29. sys-apps/util-linux[static-libs?]
  30. sys-libs/zlib[static-libs(+)?]
  31. virtual/awk
  32. "
  33. DEPEND="${COMMON_DEPEND}
  34. virtual/pkgconfig
  35. "
  36. RDEPEND="${COMMON_DEPEND}
  37. !=sys-apps/grep-2.13*
  38. !kernel-builtin? ( =sys-fs/zfs-kmod-${PV}* )
  39. !sys-fs/zfs-fuse
  40. !prefix? ( virtual/udev )
  41. test-suite? (
  42. sys-apps/util-linux
  43. sys-devel/bc
  44. sys-block/parted
  45. sys-fs/lsscsi
  46. sys-fs/mdadm
  47. sys-process/procps
  48. virtual/modutils
  49. )
  50. rootfs? (
  51. app-arch/cpio
  52. app-misc/pax-utils
  53. !<sys-boot/grub-2.00-r2:2
  54. )
  55. "
  56. pkg_setup() {
  57. :
  58. }
  59. src_prepare() {
  60. if [ ${PV} != "9999" ]
  61. then
  62. # Apply patch set
  63. EPATCH_SUFFIX="patch" \
  64. EPATCH_FORCE="yes" \
  65. epatch "${WORKDIR}/${PN}-kmod-${MY_PV}-patches"
  66. fi
  67. # Update paths
  68. sed -e "s|/sbin/lsmod|/bin/lsmod|" \
  69. -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \
  70. -e "s|/sbin/parted|/usr/sbin/parted|" \
  71. -i scripts/common.sh.in
  72. autotools-utils_src_prepare
  73. }
  74. src_configure() {
  75. use custom-cflags || strip-flags
  76. local myeconfargs=(
  77. --bindir="${EPREFIX}/bin"
  78. --sbindir="${EPREFIX}/sbin"
  79. --with-config=user
  80. --with-linux="${KV_DIR}"
  81. --with-linux-obj="${KV_OUT_DIR}"
  82. --with-udevdir="$(get_udevdir)"
  83. --with-blkid
  84. $(use_enable debug)
  85. $(use_with selinux)
  86. )
  87. autotools-utils_src_configure
  88. # prepare systemd unit and helper script
  89. cat "${FILESDIR}/zfs.service.in" | \
  90. sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \
  91. -e "s:@sysconfdir@:${EPREFIX}/etc:g" \
  92. > "${T}/zfs.service" || die
  93. cat "${FILESDIR}/zfs-init.sh.in" | \
  94. sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \
  95. -e "s:@sysconfdir@:${EPREFIX}/etc:g" \
  96. > "${T}/zfs-init.sh" || die
  97. }
  98. src_install() {
  99. autotools-utils_src_install
  100. gen_usr_ldscript -a uutil nvpair zpool zfs
  101. rm -rf "${ED}usr/lib/dracut"
  102. use test-suite || rm -rf "${ED}usr/share/zfs"
  103. use bash-completion && newbashcomp "${FILESDIR}/bash-completion-r1" zfs
  104. exeinto /usr/libexec
  105. doexe "${T}/zfs-init.sh"
  106. systemd_dounit "${T}/zfs.service"
  107. }
  108. pkg_postinst() {
  109. if ! use kernel-builtin && [ ${PV} = "9999" ]
  110. then
  111. einfo "Adding ${P} to the module database to ensure that the"
  112. einfo "kernel modules and userland utilities stay in sync."
  113. update_moduledb
  114. fi
  115. [ -e "${EROOT}etc/runlevels/boot/zfs" ] \
  116. || ewarn 'You should add zfs to the boot runlevel.'
  117. if [ -e "${EROOT}etc/runlevels/shutdown/zfs-shutdown" ]
  118. then
  119. einfo "The zfs-shutdown script is obsolete. Removing it from runlevel."
  120. rm "${EROOT}etc/runlevels/shutdown/zfs-shutdown"
  121. fi
  122. }
  123. pkg_postrm() {
  124. if ! use kernel-builtin && [ ${PV} = "9999" ]
  125. then
  126. remove_moduledb
  127. fi
  128. }