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 either the
22 # kernel itself (CONFIG_SENSORS_HDAPS) 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[hdaps] or "
26 ERROR_SENSORS_HDAPS+="kernel support for CONFIG_SENSORS_HDAPS enabled"
33 $(use_enable libconfig) \
34 --with-systemdsystemunitdir=$(systemd_get_unitdir) \
35 --docdir="${EROOT}usr/share/doc/${PF}"
40 newconfd "${FILESDIR}/hdapsd.conf-${PV}" hdapsd
41 newinitd "${FILESDIR}/hdapsd.init-${PV}" hdapsd
42 readme.gentoo_create_doc
46 [[ -z $(ls "${EROOT}"sys/block/*/queue/protect 2>/dev/null) ]] && \
47 [[ -z $(ls "${EROOT}"sys/block/*/device/unload_heads 2>/dev/null) ]] && \
48 ewarn "Your kernel does NOT support shock protection."
50 readme.gentoo_print_elog
53 DISABLE_AUTOFORMATTING=1
55 ${PN} requires a kernel module to function properly. The recommended
56 approach is to install app-laptop/tp_smapi[hdaps], but the in-tree
57 module provided by CONFIG_SENSORS_HDAPS may work as well.
59 Common daemon parameters can be set in ${EROOT}etc/conf.d/${PN}. If the
60 package was installed with USE=libconfig, then the parameters can also
61 be set in ${EROOT}etc/${PN}.conf, although the former will take
62 precedence over the latter if both are used.
64 You can change the default sampling rate by modifing
66 /sys/devices/platform/hdaps/sampling_rate
68 and you may need to enable shock protection manually by running
70 # echo -1 > /sys/block/<disk>/device/unload_heads