mdadm-3.3.1-r2.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  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=2
  8. SRC_URI="mirror://kernel/linux/utils/raid/mdadm/${P}.tar.xz
  9. mirror://debian/pool/main/m/mdadm/${PN}_3.3-${DEB_PR}.debian.tar.gz"
  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. mdadm_emake() {
  21. emake \
  22. PKG_CONFIG="$(tc-getPKG_CONFIG)" \
  23. CC="$(tc-getCC)" \
  24. CWFLAGS="-Wall" \
  25. CXFLAGS="${CFLAGS}" \
  26. UDEVDIR="$(get_udevdir)" \
  27. SYSTEMD_DIR="$(systemd_get_unitdir)" \
  28. "$@"
  29. }
  30. src_prepare() {
  31. # These are important bugfixes from upstream git after 3.3.1 release,
  32. # and before and including 17 Jul 2014:
  33. epatch \
  34. "${FILESDIR}"/${P}-Makefile-install-mdadm-grow-continue-.service.patch \
  35. "${FILESDIR}"/${P}-Grow-fix-removal-of-line-in-wrong-case.patch \
  36. "${FILESDIR}"/${P}-IMSM-use-strcpy-rather-than-pointless-strncpy.patch \
  37. "${FILESDIR}"/${P}-mdmon-ensure-Unix-domain-socket-is-created-with-safe.patch \
  38. "${FILESDIR}"/${P}-mdmon-allow-prepare_update-to-report-failure.patch \
  39. "${FILESDIR}"/${P}-DDF-validate-metadata_update-size-before-using-it.patch \
  40. "${FILESDIR}"/${P}-IMSM-validate-metadata_update-size-before-using-it.patch \
  41. "${FILESDIR}"/${P}-Grow-Do-not-try-to-restart-if-reshape-is-running.patch
  42. }
  43. src_compile() {
  44. use static && append-ldflags -static
  45. mdadm_emake all mdassemble
  46. }
  47. src_test() {
  48. mdadm_emake test
  49. sh ./test || die
  50. }
  51. src_install() {
  52. # Use split lines because of bug #517218
  53. mdadm_emake DESTDIR="${D}" install
  54. mdadm_emake DESTDIR="${D}" install-systemd
  55. into /
  56. dosbin mdassemble
  57. dodoc ChangeLog INSTALL TODO README* ANNOUNCE-${PV}
  58. insinto /etc
  59. newins mdadm.conf-example mdadm.conf
  60. newinitd "${FILESDIR}"/mdadm.rc mdadm
  61. newconfd "${FILESDIR}"/mdadm.confd mdadm
  62. newinitd "${FILESDIR}"/mdraid.rc mdraid
  63. newconfd "${FILESDIR}"/mdraid.confd mdraid
  64. # From the Debian patchset
  65. into /usr
  66. dodoc "${WORKDIR}"/debian/README.checkarray
  67. dosbin "${WORKDIR}"/debian/checkarray
  68. insinto /etc/cron.weekly
  69. newins "${FILESDIR}"/mdadm.weekly mdadm
  70. }
  71. pkg_postinst() {
  72. if ! systemd_is_booted; then
  73. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  74. # Only inform people the first time they install.
  75. elog "If you're not relying on kernel auto-detect of your RAID"
  76. elog "devices, you need to add 'mdraid' to your 'boot' runlevel:"
  77. elog " rc-update add mdraid boot"
  78. fi
  79. fi
  80. }