From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- app-laptop/hdapsd/Manifest | 7 +++ 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, 201 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..19517237ada7 --- /dev/null +++ b/app-laptop/hdapsd/Manifest @@ -0,0 +1,7 @@ +AUX hdapsd.conf-20141024 739 SHA256 dd37f05c2d2e76e9e12f7b5398a1b4a64b765ecf97c48320a7d278411e808e33 SHA512 e03c7f02af2789a784284f10eed10e10edb82e2ad16d3794299cc9622c00a047f30df7f7d553ef572e265815684d1e783932e0f3b219cca44f0e1f74dc045944 WHIRLPOOL fadc681435c884bbd56115989ce9ee461bd81c8f4aa6b77a607464ee48bf11389b6659401bccd509b1ce057cef28ff08a98b87b9b6a2ae70a746c4afc4ef0ec8 +AUX hdapsd.init-20141024 2177 SHA256 2e58c8c24a5fd12e2e265a243de4813c49066683aac55de92e84089448d63243 SHA512 e45b7e6fafd047c6fe7b172ad552c23b0000b90099a9a12e5a09133258e90d5f121bfa5e8a638f1dcd35110e54fc1da2462cdd501ebb65878286f623c7baa6dc WHIRLPOOL 859dfad31b5bacdd60f531d94e269713a77d790cfdf951db901b312fd3a8da11128622dfd0af657bffabc092746e779a4876eb0fbdfd4fc49836794123b12d0b +DIST hdapsd-20141203.tar.gz 128818 SHA256 6650db6b2251b9774bdfba34dd58f712de4c761e6c78eb61ea3b82b694cbef5e SHA512 19c1a8b362f15864b71f4fb221c0993b43b3b2d965d5826af06fb9f6b0e345e5da99181493e13e230c7fe77060ae5b373027e8ec90a511566a6ccaef43998178 WHIRLPOOL befbcbbdcfc5ae9a844f0a96703a7c9a7d43bf4c5d6d9735412efc136d9e20aff6a4dc3e5755cfa9837122b4f7890b00be53a21237838b078271ba7c9650589c +EBUILD hdapsd-20141203.ebuild 2159 SHA256 3f72bd336ab1ae9463ec9f6edc125def5cb76db4b4c64758367e8ff751164e00 SHA512 f2386ff6d0d1d6a4f09f0c314649b5e0fb93f888da3a0dba6f11c1c436e1997d3a97bc43f138c0369bf9f2e8dd7d4901b3932ed3846999930d6a85486e384275 WHIRLPOOL 049a6455907702250acb62ee29ccec2a08770691c4bffeaa16d5d72f63ec3b6fb70e55952b6b14266661c7a46b8e19969601b13af00a0bdaed7257895c925446 +MISC ChangeLog 3361 SHA256 d890b6ae2d37ff01e03b2e4f0fda7f7b460d36026ea025964f84814e46de2ae9 SHA512 7e209236f1a936b073e74408c13d304247130b6cb050265075a5a45d5d625e9ac9d5aed247a6d1a1e9733ba825aafa6e2038411eaeac22769fcac3f4c52bfbf6 WHIRLPOOL 4f17e6209bd2b6044f51c89e95b6cb2d8c713fd22373b84d50d06ab181586e35f1569441420d5f88a443bcbf4e70037f5731fac66d575089498150d1212c7590 +MISC ChangeLog-2015 4661 SHA256 c23f212d56bf87fc5600108de8a40819a53dac913cfc4f2b9be124f7ae27790c SHA512 6c9bec1d033b1d020786d89d314b0cfb27b9c21dc83ccca5acd5204e1adb394545d75d1ec72ab87af5fb748831a51adc24b0cabc1f6cedb5ac1e4bd54fa8620a WHIRLPOOL 569378bf73475bbf44a96b8a39c74bc221f918c6339bec626a809b2c5a2b181a68e1f51047af1ca711df3f8a932f1bd103ea2cba4f06a0fd24b1e203625b23d7 +MISC metadata.xml 673 SHA256 8957ea0e7a7539477181e3bba248c4e379d90be96c3d3eeb964e9f0e163b0043 SHA512 296b864ed6a816faa8dd2e65471cb74a0b8a99b29dcf315bc4d31cb81f77a1c7982cc1f1929b2331ae57d0bef3a73273793b0b8da04142d0df13d364c3ab6545 WHIRLPOOL 28dc758c3ff134e99ad148d5fd20bc0cd7f96d41d8e7a3bb2d375c68ac30e66ee8bd3d9274bee3386e28daecc24d16d167b0e98021fe4240b9cfc0c4f44d3d27 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