1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils autotools readme.gentoo systemd
11 DESCRIPTION="A simple utility to read the temperature of SMART capable hard drives"
12 HOMEPAGE="http://savannah.nongnu.org/projects/hddtemp/"
13 SRC_URI="http://download.savannah.gnu.org/releases/hddtemp/${MY_P}.tar.bz2 mirror://gentoo/hddtemp-${DBV}.db.bz2"
17 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~sparc ~x86"
18 IUSE="network-cron nls selinux"
21 RDEPEND="selinux? ( sec-policy/selinux-hddtemp )"
23 S="${WORKDIR}/${MY_P}"
25 DOCS=(README TODO ChangeLog)
27 DISABLE_AUTOFORMATTING="yes"
28 DOC_CONTENTS="In order to update your hddtemp database, run:
29 emerge --config =${CATEGORY}/${PF} or update-hddtemp.db (if USE
30 network-cron is enabled)
32 If your hard drive is not recognized by hddtemp, please consider
33 submitting your HDD info for inclusion into the Gentoo hddtemp
34 database by filing a bug at https://bugs.gentoo.org/
36 If hddtemp complains but finds your HDD temperature sensor, use the
37 --quiet option to suppress the warning.
41 epatch "${FILESDIR}"/${P}-satacmds.patch
42 epatch "${FILESDIR}"/${P}-byteswap.patch
43 epatch "${FILESDIR}"/${P}-execinfo.patch
44 epatch "${FILESDIR}"/${P}-nls.patch
45 epatch "${FILESDIR}"/${P}-iconv.patch
46 epatch "${FILESDIR}"/${P}-dontwake.patch
47 AT_M4DIR="m4" eautoreconf
53 myconf="--with-db-path=/usr/share/hddtemp/hddtemp.db"
54 # disabling nls breaks compiling
55 use nls || myconf="--disable-nls ${myconf}"
62 insinto /usr/share/hddtemp
63 newins "${WORKDIR}/hddtemp-${DBV}.db" hddtemp.db
64 doins "${FILESDIR}"/hddgentoo.db
66 update_db "${D}/usr/share/hddtemp/hddgentoo.db" "${D}/usr/share/hddtemp/hddtemp.db"
67 newconfd "${FILESDIR}"/hddtemp-conf.d hddtemp
68 newinitd "${FILESDIR}"/hddtemp-init hddtemp
69 systemd_newunit "${FILESDIR}"/hddtemp.service-r1 "${PN}.service"
70 systemd_install_serviced "${FILESDIR}"/hddtemp.service.conf
72 readme.gentoo_create_doc
74 if use network-cron; then
75 dosbin "${FILESDIR}"/update-hddtemp.db
76 exeinto /etc/cron.monthly
77 echo -e "#!/bin/sh\n/usr/sbin/update-hddtemp.db" > "${T}"/hddtemp.cron
78 newexe "${T}"/hddtemp.cron update-hddtemp.db
87 if [[ -z $(echo "${line}" | sed -re 's/(^#.*|^\w*$)//') ]]; then
88 echo "${line}" >> "${dst}"
91 id=$(echo "${line}" | grep -o '"[^"]*"')
93 grep "${id}" "${dst}" 2>&1 >/dev/null || echo "${line}" >> "${dst}"
98 cd "${ROOT}"/usr/share/hddtemp || die
100 einfo "Trying to download the latest hddtemp.db file"
101 wget http://www.guzu.net/linux/hddtemp.db -O hddtemp.db \
102 || die "failed to download hddtemp.db"
104 update_db "hddgentoo.db" "hddtemp.db"