Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-laptop/hdapsd/
Date: Tue, 28 Jun 2022 17:20:52
Message-Id: 1656436764.ff09d4171727264650aea7a7d4cd9e34e89fbaf4.mjo@gentoo
1 commit: ff09d4171727264650aea7a7d4cd9e34e89fbaf4
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 28 17:09:34 2022 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 28 17:19:24 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff09d417
7
8 app-laptop/hdapsd: new revision to get the udevdir from udev.eclass.
9
10 Also update to EAPI=8 and call udev_reload() where appropriate.
11
12 Closes: https://bugs.gentoo.org/854684
13 Package-Manager: Portage-3.0.30, Repoman-3.0.3
14 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
15
16 app-laptop/hdapsd/hdapsd-20141203-r3.ebuild | 79 +++++++++++++++++++++++++++++
17 1 file changed, 79 insertions(+)
18
19 diff --git a/app-laptop/hdapsd/hdapsd-20141203-r3.ebuild b/app-laptop/hdapsd/hdapsd-20141203-r3.ebuild
20 new file mode 100644
21 index 000000000000..ee9f8da5e64c
22 --- /dev/null
23 +++ b/app-laptop/hdapsd/hdapsd-20141203-r3.ebuild
24 @@ -0,0 +1,79 @@
25 +# Copyright 1999-2022 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=8
29 +inherit linux-info readme.gentoo-r1 systemd udev
30 +
31 +DESCRIPTION="IBM ThinkPad Hard Drive Active Protection System (HDAPS) daemon"
32 +HOMEPAGE="https://github.com/evgeni/hdapsd/"
33 +SRC_URI="https://github.com/evgeni/${PN}/releases/download/${PV}/${P}.tar.gz"
34 +
35 +LICENSE="GPL-2"
36 +SLOT="0"
37 +KEYWORDS="~amd64 ~x86"
38 +IUSE="libconfig"
39 +
40 +BDEPEND=""
41 +DEPEND="libconfig? ( dev-libs/libconfig:= )"
42 +RDEPEND="${DEPEND}"
43 +
44 +pkg_setup() {
45 + # We require the hdaps module which can either come from either the
46 + # kernel itself (CONFIG_SENSORS_HDAPS) or from the tp_smapi package.
47 + if ! has_version app-laptop/tp_smapi[hdaps]; then
48 + CONFIG_CHECK="~SENSORS_HDAPS"
49 + ERROR_SENSORS_HDAPS="${P} requires app-laptop/tp_smapi[hdaps] or "
50 + ERROR_SENSORS_HDAPS+="kernel support for CONFIG_SENSORS_HDAPS enabled"
51 + linux-info_pkg_setup
52 + fi
53 +}
54 +
55 +src_configure() {
56 + econf \
57 + $(use_enable libconfig) \
58 + --with-systemdsystemunitdir=$(systemd_get_systemunitdir) \
59 + --with-udevdir="$(get_udevdir)" \
60 + --docdir="/usr/share/doc/${PF}"
61 +}
62 +
63 +src_install() {
64 + default
65 + newconfd "${FILESDIR}/hdapsd.conf-20141024" hdapsd
66 + newinitd "${FILESDIR}/hdapsd.init-20141024" hdapsd
67 + readme.gentoo_create_doc
68 +}
69 +
70 +pkg_postinst() {
71 + [[ -z $(ls "${ROOT}"/sys/block/*/queue/protect 2>/dev/null) ]] && \
72 + [[ -z $(ls "${ROOT}"/sys/block/*/device/unload_heads 2>/dev/null) ]] && \
73 + ewarn "Your kernel does NOT support shock protection."
74 +
75 + readme.gentoo_print_elog
76 + udev_reload
77 +}
78 +
79 +pkg_postrm() {
80 + udev_reload
81 +}
82 +
83 +DISABLE_AUTOFORMATTING=1
84 +DOC_CONTENTS="
85 +${PN} requires a kernel module to function properly. The recommended
86 +approach is to install app-laptop/tp_smapi[hdaps], but the in-tree
87 +module provided by CONFIG_SENSORS_HDAPS may work as well.
88 +
89 +Common daemon parameters can be set in ${EROOT}/etc/conf.d/${PN}. If the
90 +package was installed with USE=libconfig, then the parameters can also
91 +be set in ${EROOT}/etc/${PN}.conf, although the former will take
92 +precedence over the latter if both are used.
93 +
94 +You can change the default sampling rate by modifing
95 +
96 + /sys/devices/platform/hdaps/sampling_rate
97 +
98 +and you may need to enable shock protection manually by running
99 +
100 + # echo -1 > /sys/block/<disk>/device/unload_heads
101 +
102 +as root.
103 +"