mdadm-4.0.ebuild 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 systemd toolchain-funcs udev
  5. DESCRIPTION="A useful tool for running RAID systems - it can be used as a replacement for the raidtools"
  6. HOMEPAGE="http://neil.brown.name/blog/mdadm"
  7. DEB_PR=4
  8. SRC_URI="mirror://kernel/linux/utils/raid/mdadm/${P}.tar.xz
  9. mirror://debian/pool/main/m/mdadm/${PN}_3.4-${DEB_PR}.debian.tar.xz"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  13. IUSE="static"
  14. DEPEND="virtual/pkgconfig
  15. app-arch/xz-utils"
  16. RDEPEND=">=sys-apps/util-linux-2.16"
  17. # The tests edit values in /proc and run tests on software raid devices.
  18. # Thus, they shouldn't be run on systems with active software RAID devices.
  19. RESTRICT="test"
  20. src_prepare() {
  21. epatch "${FILESDIR}"/${PN}-3.4-sysmacros.patch #580188
  22. }
  23. mdadm_emake() {
  24. # We should probably make corosync & libdlm into USE flags. #573782
  25. emake \
  26. PKG_CONFIG="$(tc-getPKG_CONFIG)" \
  27. CC="$(tc-getCC)" \
  28. CWFLAGS="-Wall" \
  29. CXFLAGS="${CFLAGS}" \
  30. UDEVDIR="$(get_udevdir)" \
  31. SYSTEMD_DIR="$(systemd_get_unitdir)" \
  32. COROSYNC="-DNO_COROSYNC" \
  33. DLM="-DNO_DLM" \
  34. "$@"
  35. }
  36. src_compile() {
  37. use static && append-ldflags -static
  38. mdadm_emake all mdassemble
  39. }
  40. src_test() {
  41. mdadm_emake test
  42. sh ./test || die
  43. }
  44. src_install() {
  45. mdadm_emake DESTDIR="${D}" install install-systemd
  46. into /
  47. dosbin mdassemble
  48. dodoc ChangeLog INSTALL TODO README* ANNOUNCE-${PV}
  49. insinto /etc
  50. newins mdadm.conf-example mdadm.conf
  51. newinitd "${FILESDIR}"/mdadm.rc mdadm
  52. newconfd "${FILESDIR}"/mdadm.confd mdadm
  53. newinitd "${FILESDIR}"/mdraid.rc mdraid
  54. newconfd "${FILESDIR}"/mdraid.confd mdraid
  55. # From the Debian patchset
  56. into /usr
  57. dodoc "${WORKDIR}"/debian/README.checkarray
  58. dosbin "${WORKDIR}"/debian/checkarray
  59. insinto /etc/default
  60. newins "${FILESDIR}"/etc-default-mdadm mdadm
  61. exeinto /etc/cron.weekly
  62. newexe "${FILESDIR}"/mdadm.weekly mdadm
  63. }
  64. pkg_postinst() {
  65. if ! systemd_is_booted; then
  66. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  67. # Only inform people the first time they install.
  68. elog "If you're not relying on kernel auto-detect of your RAID"
  69. elog "devices, you need to add 'mdraid' to your 'boot' runlevel:"
  70. elog " rc-update add mdraid boot"
  71. fi
  72. fi
  73. }