]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - app-laptop/hdapsd/hdapsd-20141024.ebuild
Manifest bump.
[mjo-overlay.git] / app-laptop / hdapsd / hdapsd-20141024.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=5
6 inherit linux-info readme.gentoo systemd
7
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"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="libconfig"
16
17 DEPEND="libconfig? ( dev-libs/libconfig )"
18 RDEPEND="${DEPEND}"
19
20 pkg_setup() {
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"
27 linux-info_pkg_setup
28 fi
29 }
30
31 src_configure(){
32 econf \
33 $(use_enable libconfig) \
34 --with-systemdsystemunitdir=$(systemd_get_unitdir) \
35 --docdir="${EROOT}usr/share/doc/${PF}"
36 }
37
38 src_install() {
39 default
40 newconfd "${FILESDIR}/hdapsd.conf-${PV}" hdapsd
41 newinitd "${FILESDIR}/hdapsd.init-${PV}" hdapsd
42 readme.gentoo_create_doc
43 }
44
45 pkg_postinst(){
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."
49
50 readme.gentoo_print_elog
51 }
52
53 DISABLE_AUTOFORMATTING=1
54 DOC_CONTENTS="
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.
58
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.
63
64 You can change the default sampling rate by modifing
65
66 /sys/devices/platform/hdaps/sampling_rate
67
68 and you may need to enable shock protection manually by running
69
70 # echo -1 > /sys/block/<disk>/device/unload_heads
71
72 as root.
73 "