hddtemp-0.3_beta15-r7.ebuild 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils autotools readme.gentoo systemd
  5. MY_P=${P/_beta/-beta}
  6. DBV=20080531
  7. DESCRIPTION="A simple utility to read the temperature of SMART capable hard drives"
  8. HOMEPAGE="https://savannah.nongnu.org/projects/hddtemp/"
  9. SRC_URI="http://download.savannah.gnu.org/releases/hddtemp/${MY_P}.tar.bz2 mirror://gentoo/hddtemp-${DBV}.db.bz2"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="alpha amd64 arm hppa ia64 ppc sparc x86"
  13. IUSE="nls selinux"
  14. DEPEND=""
  15. RDEPEND="selinux? ( sec-policy/selinux-hddtemp )"
  16. S="${WORKDIR}/${MY_P}"
  17. DISABLE_AUTOFORMATTING="yes"
  18. DOC_CONTENTS="In order to update your hddtemp database, run:
  19. emerge --config =${CATEGORY}/${PF}
  20. If your hard drive is not recognized by hddtemp, please consider
  21. submitting your HDD info for inclusion into the Gentoo hddtemp
  22. database by filing a bug at https://bugs.gentoo.org/
  23. If hddtemp complains but finds your HDD temperature sensor, use the
  24. --quiet option to suppress the warning.
  25. "
  26. src_prepare() {
  27. epatch "${FILESDIR}"/${P}-satacmds.patch
  28. epatch "${FILESDIR}"/${P}-byteswap.patch
  29. epatch "${FILESDIR}"/${P}-execinfo.patch
  30. epatch "${FILESDIR}"/${P}-nls.patch
  31. epatch "${FILESDIR}"/${P}-iconv.patch
  32. epatch "${FILESDIR}"/${P}-dontwake.patch
  33. mv "${S}"/configure.{in,ac} || die
  34. AT_M4DIR="m4" eautoreconf
  35. }
  36. src_configure() {
  37. local myconf
  38. myconf="--with-db-path=/usr/share/hddtemp/hddtemp.db"
  39. # disabling nls breaks compiling
  40. use nls || myconf="--disable-nls ${myconf}"
  41. econf ${myconf}
  42. }
  43. src_install() {
  44. default
  45. dodoc README TODO ChangeLog
  46. insinto /usr/share/hddtemp
  47. newins "${WORKDIR}/hddtemp-${DBV}.db" hddtemp.db
  48. doins "${FILESDIR}"/hddgentoo.db
  49. update_db "${D}/usr/share/hddtemp/hddgentoo.db" "${D}/usr/share/hddtemp/hddtemp.db"
  50. newconfd "${FILESDIR}"/hddtemp-conf.d hddtemp
  51. newinitd "${FILESDIR}"/hddtemp-init hddtemp
  52. systemd_newunit "${FILESDIR}"/hddtemp.service-r1 "${PN}.service"
  53. systemd_install_serviced "${FILESDIR}"/hddtemp.service.conf
  54. readme.gentoo_create_doc
  55. }
  56. update_db() {
  57. local src=$1
  58. local dst=$2
  59. while read line ; do
  60. if [[ -z $(echo "${line}" | sed -re 's/(^#.*|^\w*$)//') ]]; then
  61. echo "${line}" >> "${dst}"
  62. fi
  63. id=$(echo "${line}" | grep -o '"[^"]*"')
  64. grep "${id}" "${dst}" 2>&1 >/dev/null || echo "${line}" >> "${dst}"
  65. done < "${src}"
  66. }
  67. pkg_config() {
  68. cd "${ROOT}"/usr/share/hddtemp || die
  69. einfo "Trying to download the latest hddtemp.db file"
  70. wget http://www.guzu.net/linux/hddtemp.db -O hddtemp.db \
  71. || die "failed to download hddtemp.db"
  72. update_db "hddgentoo.db" "hddtemp.db"
  73. }