smartmontools-9999.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit flag-o-matic systemd
  5. if [[ ${PV} == "9999" ]] ; then
  6. ESVN_REPO_URI="https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools"
  7. ESVN_PROJECT="smartmontools"
  8. inherit subversion autotools
  9. else
  10. SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
  11. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos"
  12. fi
  13. DESCRIPTION="Tools to monitor storage systems to provide advanced warning of disk degradation"
  14. HOMEPAGE="https://www.smartmontools.org"
  15. LICENSE="GPL-2"
  16. SLOT="0"
  17. IUSE="caps minimal selinux static update_drivedb"
  18. DEPEND="
  19. caps? (
  20. static? ( sys-libs/libcap-ng[static-libs] )
  21. !static? ( sys-libs/libcap-ng )
  22. )
  23. selinux? (
  24. sys-libs/libselinux
  25. )"
  26. RDEPEND="${DEPEND}
  27. !minimal? ( virtual/mailx )
  28. selinux? ( sec-policy/selinux-smartmon )
  29. "
  30. src_prepare() {
  31. if [[ ${PV} == "9999" ]] ; then
  32. eautoreconf
  33. fi
  34. }
  35. src_configure() {
  36. use minimal && einfo "Skipping the monitoring daemon for minimal build."
  37. use static && append-ldflags -static
  38. # The build installs /etc/init.d/smartd, but we clobber it
  39. # in our src_install, so no need to manually delete it.
  40. myeconfargs=(
  41. --docdir="${EPREFIX}/usr/share/doc/${PF}"
  42. --with-drivedbdir="${EPREFIX}/var/db/${PN}" #575292
  43. --with-initscriptdir="${EPREFIX}/etc/init.d"
  44. $(use_with caps libcap-ng)
  45. $(use_with selinux)
  46. $(systemd_with_unitdir)
  47. $(use_with update_drivedb update-smart-drivedb)
  48. )
  49. econf "${myeconfargs[@]}"
  50. }
  51. src_install() {
  52. local db_path="/var/db/${PN}"
  53. if use minimal ; then
  54. dosbin smartctl
  55. doman smartctl.8
  56. else
  57. default
  58. newinitd "${FILESDIR}"/smartd-r1.rc smartd
  59. newconfd "${FILESDIR}"/smartd.confd smartd
  60. keepdir "${db_path}"
  61. if use update_drivedb ; then
  62. # Move drivedb.h file out of PM's sight (bug #575292)
  63. mv "${ED}${db_path}/drivedb.h" "${T}" || die
  64. exeinto /etc/cron.monthly
  65. doexe "${FILESDIR}/${PN}-update-drivedb"
  66. fi
  67. fi
  68. }
  69. pkg_postinst() {
  70. if ! use minimal ; then
  71. local db_path="/var/db/${PN}"
  72. if [[ -f "${db_path}/drivedb.h" ]] ; then
  73. ewarn "WARNING! The existing copy of the drive database has been replaced with the version that"
  74. ewarn "was shipped with this release of ${PN}. You may want to update the"
  75. ewarn "database by: "
  76. if ! use update_drivedb ; then
  77. ewarn "re-merging ${PN} with USE='update_drivedb', then"
  78. fi
  79. ewarn "running the following command as root:"
  80. ewarn ""
  81. ewarn "/usr/sbin/update-smart-drivedb"
  82. fi
  83. if use update_drivedb ; then
  84. # Move drivedb.h to /var/db/${PN} (bug #575292)
  85. mv "${T}"/drivedb.h "${db_path}" || die
  86. fi
  87. fi
  88. }