From 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 Jul 2018 21:03:06 +0100 Subject: gentoo resync : 14.07.2018 --- app-laptop/hdapsd/Manifest | 5 ++ app-laptop/hdapsd/files/hdapsd.conf-20141024 | 24 +++++++++ app-laptop/hdapsd/files/hdapsd.init-20141024 | 76 ++++++++++++++++++++++++++++ app-laptop/hdapsd/hdapsd-20141203.ebuild | 72 ++++++++++++++++++++++++++ app-laptop/hdapsd/metadata.xml | 22 ++++++++ 5 files changed, 199 insertions(+) create mode 100644 app-laptop/hdapsd/Manifest create mode 100644 app-laptop/hdapsd/files/hdapsd.conf-20141024 create mode 100644 app-laptop/hdapsd/files/hdapsd.init-20141024 create mode 100644 app-laptop/hdapsd/hdapsd-20141203.ebuild create mode 100644 app-laptop/hdapsd/metadata.xml (limited to 'app-laptop/hdapsd') diff --git a/app-laptop/hdapsd/Manifest b/app-laptop/hdapsd/Manifest new file mode 100644 index 000000000000..f478ce434af0 --- /dev/null +++ b/app-laptop/hdapsd/Manifest @@ -0,0 +1,5 @@ +AUX hdapsd.conf-20141024 739 BLAKE2B ebd52e9bc5d4849b842cb579ca4ea0892227c94c483d9ec0b9b1dbcf975bfdfb0079460a29dedb6e60236cf9a37814efdd900c6e8c8d4791deb2e81f37dfbbd6 SHA512 e03c7f02af2789a784284f10eed10e10edb82e2ad16d3794299cc9622c00a047f30df7f7d553ef572e265815684d1e783932e0f3b219cca44f0e1f74dc045944 +AUX hdapsd.init-20141024 2177 BLAKE2B c790b9899ca67ecee13a3af54dc821020f551ec35e94866328e28b00ea79eb2f8ba88e618d6b1d854add6024abb75f7fdc1393bfff853f16e2ab4bfb16e03799 SHA512 e45b7e6fafd047c6fe7b172ad552c23b0000b90099a9a12e5a09133258e90d5f121bfa5e8a638f1dcd35110e54fc1da2462cdd501ebb65878286f623c7baa6dc +DIST hdapsd-20141203.tar.gz 128818 BLAKE2B 0219e30e032032dfd729e97f526eb7402fe4cb72245589ef03cca28f75a6e1f2cbfa55c5aa5599b24f496bbe662467077415fbec47caa1db17d6108e07292daa SHA512 19c1a8b362f15864b71f4fb221c0993b43b3b2d965d5826af06fb9f6b0e345e5da99181493e13e230c7fe77060ae5b373027e8ec90a511566a6ccaef43998178 +EBUILD hdapsd-20141203.ebuild 2159 BLAKE2B 19848e3eedba19f42a9e0991527767fdbf6bdc638a83976fdb1ae390fa2ca03ed6b416dfa4543a9759773e5a3867d8515ad7c74e46e9c1947402b4fa3402740b SHA512 f2386ff6d0d1d6a4f09f0c314649b5e0fb93f888da3a0dba6f11c1c436e1997d3a97bc43f138c0369bf9f2e8dd7d4901b3932ed3846999930d6a85486e384275 +MISC metadata.xml 673 BLAKE2B d0dd1b8ff7d65cf628b0bd9841072a578953fec9d343a87ff91666de3f74079e911ce578a732b32cd6a3709c92ae6dcf13ac899d635f84e67c770af6212a315a SHA512 296b864ed6a816faa8dd2e65471cb74a0b8a99b29dcf315bc4d31cb81f77a1c7982cc1f1929b2331ae57d0bef3a73273793b0b8da04142d0df13d364c3ab6545 diff --git a/app-laptop/hdapsd/files/hdapsd.conf-20141024 b/app-laptop/hdapsd/files/hdapsd.conf-20141024 new file mode 100644 index 000000000000..a83d8bb181ac --- /dev/null +++ b/app-laptop/hdapsd/files/hdapsd.conf-20141024 @@ -0,0 +1,24 @@ +# Configuration for the HDAPS daemon (hdapsd). All settings here are +# optional and will override those set in /etc/hdapsd.conf (if hdapsd +# was built with libconfig support). + +# The list of the disk devices that hdapsd should monitor. Usually +# this is "hda", "sda", or "hda sda". The hdaps daemon will attempt to +# auto-detect your drive if this is left empty. Empty by default. +# +#DISKLIST="sda" + +# Hdapsd sensitivity. The lower the threshold, the earlier the heads +# are parked when movement is detected. The default is determined by +# hdapsd, and is currently 15. +# +#THRESHOLD="10" + +# Log to syslog? Disabled by default. +# +#SYSLOG="true" + +# Set any extra options here, like -a for "adaptive mode". Empty by +# default. +# +#OPTIONS="-a" diff --git a/app-laptop/hdapsd/files/hdapsd.init-20141024 b/app-laptop/hdapsd/files/hdapsd.init-20141024 new file mode 100644 index 000000000000..6113b60b7d7c --- /dev/null +++ b/app-laptop/hdapsd/files/hdapsd.init-20141024 @@ -0,0 +1,76 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 + +description="Hard Drive Active Protection System daemon" +command="/usr/sbin/hdapsd" +pidfile="/run/hdapsd.pid" + +# Always daemonize when started by OpenRC, and don't make the pidfile +# configurable. Even if the user sets something dumb for the pidfile +# in /etc/hdapsd.conf, we want it to work! Fortunately the settings +# passed on the command-line override the config file. +command_args="--background --pidfile=${pidfile}" + + +depend() { + need localmount +} + +checkconfig() { + # An empty DISKLIST is allowed because the disk will be + # auto-detected. + for DISK in ${DISKLIST}; do + if [ ! -b /dev/${DISK} ]; then + eerror "Could not find disk /dev/${DISK}!" + eerror "Adjust the DISK setting in /etc/conf.d/hdapsd" + return 1 + fi + + if [ ! -e /sys/block/${DISK}/queue/protect ] && \ + [ ! -e /sys/block/${DISK}/device/unload_heads ] ; then + eerror "No protect entry for ${DISK}!" + eerror "Make sure your kernel is patched with the blk_freeze patch" + return 1 + fi + done + + # Load the tp_smapi module first. This is not a requirement, but + # it helps hdapsd's adaptive mode. + if [ ! -e /sys/devices/platform/smapi ] ; then + modprobe tp_smapi 2>/dev/null + fi + + if [ ! -d /sys/devices/platform/hdaps ] ; then + ebegin "Loading hdaps module" + modprobe hdaps + eend $? || return 1 + fi +} + +start() { + checkconfig || return 1 + + for DISK in ${DISKLIST}; do + command_args="${command_args} -d ${DISK}" + done + + # Since all of these settings are now optional, we append them + # only if we need to. + if [ ! -z "${THRESHOLD}" ] ; then + command_args="${command_args} --sensitivity ${THRESHOLD}" + fi + + if [ ! -z "${SYSLOG}" ] ; then + command_args="${command_args} --syslog" + fi + + if [ ! -z "${OPTIONS}" ] ; then + command_args="${command_args} ${OPTIONS}" + fi + + ebegin "Starting the ${description}" + start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}" \ + -- ${command_args} + eend $? +} diff --git a/app-laptop/hdapsd/hdapsd-20141203.ebuild b/app-laptop/hdapsd/hdapsd-20141203.ebuild new file mode 100644 index 000000000000..6edd851d9605 --- /dev/null +++ b/app-laptop/hdapsd/hdapsd-20141203.ebuild @@ -0,0 +1,72 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 +inherit linux-info readme.gentoo systemd + +DESCRIPTION="IBM ThinkPad Hard Drive Active Protection System (HDAPS) daemon" +HOMEPAGE="https://github.com/evgeni/${PN}/" +SRC_URI="https://github.com/evgeni/${PN}/releases/download/${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 x86" +IUSE="libconfig" + +DEPEND="libconfig? ( dev-libs/libconfig )" +RDEPEND="${DEPEND}" + +pkg_setup() { + # We require the hdaps module which can either come from either the + # kernel itself (CONFIG_SENSORS_HDAPS) or from the tp_smapi package. + if ! has_version app-laptop/tp_smapi[hdaps]; then + CONFIG_CHECK="~SENSORS_HDAPS" + ERROR_SENSORS_HDAPS="${P} requires app-laptop/tp_smapi[hdaps] or " + ERROR_SENSORS_HDAPS+="kernel support for CONFIG_SENSORS_HDAPS enabled" + linux-info_pkg_setup + fi +} + +src_configure(){ + econf \ + $(use_enable libconfig) \ + --with-systemdsystemunitdir=$(systemd_get_unitdir) \ + --docdir="/usr/share/doc/${PF}" +} + +src_install() { + default + newconfd "${FILESDIR}/hdapsd.conf-20141024" hdapsd + newinitd "${FILESDIR}/hdapsd.init-20141024" hdapsd + readme.gentoo_create_doc +} + +pkg_postinst(){ + [[ -z $(ls "${ROOT}"sys/block/*/queue/protect 2>/dev/null) ]] && \ + [[ -z $(ls "${ROOT}"sys/block/*/device/unload_heads 2>/dev/null) ]] && \ + ewarn "Your kernel does NOT support shock protection." + + readme.gentoo_print_elog +} + +DISABLE_AUTOFORMATTING=1 +DOC_CONTENTS=" +${PN} requires a kernel module to function properly. The recommended +approach is to install app-laptop/tp_smapi[hdaps], but the in-tree +module provided by CONFIG_SENSORS_HDAPS may work as well. + +Common daemon parameters can be set in ${EROOT}etc/conf.d/${PN}. If the +package was installed with USE=libconfig, then the parameters can also +be set in ${EROOT}etc/${PN}.conf, although the former will take +precedence over the latter if both are used. + +You can change the default sampling rate by modifing + + /sys/devices/platform/hdaps/sampling_rate + +and you may need to enable shock protection manually by running + + # echo -1 > /sys/block//device/unload_heads + +as root. +" diff --git a/app-laptop/hdapsd/metadata.xml b/app-laptop/hdapsd/metadata.xml new file mode 100644 index 000000000000..ab39df1369a0 --- /dev/null +++ b/app-laptop/hdapsd/metadata.xml @@ -0,0 +1,22 @@ + + + + + junghans@gentoo.org + Christoph Junghans + + + mjo@gentoo.org + Michael Orlitzky + + + + Require dev-libs/libconfig to allow the daemon to + read a configuration file at startup + + + + evgeni/hdapsd + hdaps + + -- cgit v1.2.3