smartmontools-6.4-r1.ebuild 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 ~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"
  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. # 580424
  32. sed '/^SRCEXPR/s@http:@https:@' \
  33. -i update-smart-drivedb.in \
  34. || die
  35. if [[ ${PV} == "9999" ]] ; then
  36. eautoreconf
  37. fi
  38. }
  39. src_configure() {
  40. use minimal && einfo "Skipping the monitoring daemon for minimal build."
  41. use static && append-ldflags -static
  42. # The build installs /etc/init.d/smartd, but we clobber it
  43. # in our src_install, so no need to manually delete it.
  44. myeconfargs=(
  45. --docdir="${EPREFIX}/usr/share/doc/${PF}"
  46. --with-drivedbdir=/var/db/${PN} #575292
  47. --with-initscriptdir="${EPREFIX}/etc/init.d"
  48. $(use_with caps libcap-ng)
  49. $(use_with selinux)
  50. $(systemd_with_unitdir)
  51. )
  52. econf "${myeconfargs[@]}"
  53. }
  54. src_install() {
  55. local db_path="/var/db/${PN}"
  56. if use minimal ; then
  57. dosbin smartctl
  58. doman smartctl.8
  59. else
  60. default
  61. newinitd "${FILESDIR}"/smartd-r1.rc smartd
  62. newconfd "${FILESDIR}"/smartd.confd smartd
  63. # Move drivedb.h file out of PM's sight (bug #575292)
  64. mv "${ED}${db_path}/drivedb.h" "${T}" || die
  65. keepdir "${db_path}"
  66. exeinto /etc/cron.monthly
  67. doexe "${FILESDIR}"/${PN}-update-drivedb
  68. fi
  69. }
  70. pkg_postinst() {
  71. if ! use minimal ; then
  72. local db_path="/var/db/${PN}"
  73. if [[ -f "${db_path}/drivedb.h" ]] ; then
  74. ewarn "WARNING! The existing copy of the drive database has been replaced with the version that"
  75. ewarn "was shipped with this release of ${PN}. You may want to update the"
  76. ewarn "database by running the following command as root:"
  77. ewarn ""
  78. ewarn "/usr/sbin/update-smart-drivedb"
  79. fi
  80. # Move drivedb.h to /var/db/${PN} (bug #575292)
  81. mv "${T}"/drivedb.h "${db_path}" || die
  82. fi
  83. }