1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit linux-info readme.gentoo systemd
8 DESCRIPTION="IBM ThinkPad Hard Drive Active Protection System (HDAPS) daemon"
9 HOMEPAGE="https://github.com/evgeni/${PN}/"
10 SRC_URI="https://github.com/evgeni/${PN}/releases/download/${PV}/${P}.tar.gz"
14 KEYWORDS="~amd64 ~x86"
17 DEPEND="libconfig? ( dev-libs/libconfig )"
21 # We require the hdaps module which can either come from kernel sources
22 # or from the tp_smapi package.
23 if ! has_version app-laptop/tp_smapi[hdaps]; then
24 CONFIG_CHECK="~SENSORS_HDAPS"
25 ERROR_SENSORS_HDAPS="${P} requires app-laptop/tp_smapi (with hdaps USE enabled) or support for CONFIG_SENSORS_HDAPS enabled"
29 DOC_CONTENTS="You can change the default frequency by modifing /sys/devices/platform/hdaps/sampling_rate.
30 You might need to enable shock protection manually by running:\n
31 # echo -1 > /sys/block/DEVICE/device/unload_heads"
36 $(use_enable libconfig) \
37 --with-systemdsystemunitdir=$(systemd_get_unitdir) \
38 --docdir="${EROOT}usr/share/doc/${PF}"
43 newconfd "${FILESDIR}"/hdapsd.conf.3 hdapsd
44 newinitd "${FILESDIR}"/hdapsd.init.3 hdapsd
45 readme.gentoo_create_doc
49 [[ -z $(ls "${EROOT}"sys/block/*/queue/protect 2>/dev/null) ]] && \
50 [[ -z $(ls "${EROOT}"sys/block/*/device/unload_heads 2>/dev/null) ]] && \
51 ewarn "Your kernel does NOT support shock protection."
53 if ! has_version app-laptop/tp_smapi[hdaps]; then
54 ewarn "Using the hdaps module provided by app-laptop/tp_smapi instead"
55 ewarn "of the in-kernel driver is strongly recommended!"
58 readme.gentoo_print_elog