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 "
26 ERROR_SENSORS_HDAPS+="USE enabled) or kernel support for "
27 ERROR_SENSORS_HDAPS+="CONFIG_SENSORS_HDAPS enabled"
34 $(use_enable libconfig) \
35 --with-systemdsystemunitdir=$(systemd_get_unitdir) \
36 --docdir="${EROOT}usr/share/doc/${PF}"
41 newconfd "${FILESDIR}/hdapsd.conf-${PV}" hdapsd
42 newinitd "${FILESDIR}/hdapsd.init-${PV}" hdapsd
43 readme.gentoo_create_doc
47 [[ -z $(ls "${EROOT}"sys/block/*/queue/protect 2>/dev/null) ]] && \
48 [[ -z $(ls "${EROOT}"sys/block/*/device/unload_heads 2>/dev/null) ]] && \
49 ewarn "Your kernel does NOT support shock protection."
51 if ! has_version app-laptop/tp_smapi[hdaps]; then
52 ewarn "Using the hdaps module provided by app-laptop/tp_smapi instead"
53 ewarn "of the in-kernel driver is strongly recommended!"
56 readme.gentoo_print_elog
59 DISABLE_AUTOFORMATTING=1
61 You can change the default frequency by modifing,
63 /sys/devices/platform/hdaps/sampling_rate
65 You might need to enable shock protection manually by running:
67 # echo -1 > /sys/block/DEVICE/device/unload_heads