zfs-0.6.1-r4.ebuild 3.6 KB

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