--- /dev/null
+AUX hdapsd.conf.3 585 SHA256 f7ce973e33e1ac822a6bdcf0be00d94183de4a4c43ffd46d0e37e5db473265f9 SHA512 f37edafc3bed4895bee4f7c715c258d1ccbf05fb424bb905cc4aec77017ebf4402ddd492cc48774509cc30afe81e19a4abf73c8e87db1b138e7c294328e87837 WHIRLPOOL 236966d4373eedeb58b520c3de4c3940bcc3881a80f323ef459f26395530584b343cd7c9dcbb2ad5920e4e3ba5ff9f497d0b6af6879a85881f2c0ae7f1eb0370
+AUX hdapsd.init.3 1885 SHA256 769dd3670016bdb23b95401dcc04d3f1007b6ed1676bdfb164350f2d962725d7 SHA512 6e4cfafb3665696e00d60e467ed81114d2089c31d82ad4db246514eea169eec1a916e62d0c932f14a689c95b06432c271b19009748c3594b43cd5fda4efae844 WHIRLPOOL c94a7f5fd10571cb5ff016f94ec6cf9aa6b0c8c24fe9fe0680b13d9a8e84efeb13a3232059dea4a6079203e9d1625a16a8198ea2a7def1290a5fee7ad10792f6
+DIST hdapsd-20141024.tar.gz 128580 SHA256 4a9f7c4d6351bd31757f236ad832ceccf10280d32bcaf4c25d15dc4ecc84581f SHA512 2d956ce1e6691f41d0f39a4d29c244b5a7ed7ebed4c979a39131e311a4cea3374150cd4ca1da4033e483c3ea0da4e8ca01f20e599a65278dd0674e29a086c540 WHIRLPOOL ed1c536fde7e212e38af8ba54d8a712d70b550d647ec93aff05c866ee7e2e41a563adb73fd20e3e540c87c90089a41c60fe3ec8c8406785bc59446d7f0b94831
+EBUILD hdapsd-20141024.ebuild 1820 SHA256 7669d3f0b6604956134c62766e2a26d247fa8f273121793081353bd717617e72 SHA512 3dcc516289d690fbfaebe138cec07f8193794ce64feb509325b485a7f817b41403338dc4fccbbb00234bc0f0a4ad29996b251354529f1f22f37465ee06b5c517 WHIRLPOOL 85d2683c3e2898bacfd48d7434189168be6c8b833cad5463082bb7608354778f5a09574561e42c7af17bad0985311b9615363767c57d593155d8168c002242d4
+MISC metadata.xml 411 SHA256 7b1b223aca5553979c2d593e5c8611ab4a2c4d3135b35511213fba3fb626c3c0 SHA512 4430613ede7fc6207250a505e246f9e81e68cb7f23bea4ac79a60ef2001a4f62f4e0db09c28b0a71cdbdcf547e5c62c669db210780cede0b5fa3e079866e10dd WHIRLPOOL 1c50cc056fa80da79ecfe890b319121b56cd12ed9ab1775858e3dcb41d3d30d427d8091ed49341508fd45099022df4de7f848cc25fd3531f344ca4c9498bf2a2
--- /dev/null
+# 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.
+#
+#DISKLIST="sda"
+
+# Hdapsd sensitivity. The lower the threshold, the earlier the heads
+# are parked when movement is detected.
+#
+#THRESHOLD="10"
+
+# Set any extra options here, like -a for "adaptive mode".
+#
+#OPTIONS="-a"
--- /dev/null
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+
+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
+
+ local DISKOPTS DISK
+ for DISK in ${DISKLIST}; do
+ DISKOPTS="${DISKOPTS} -d ${DISK}"
+ done
+
+ # Since we're allowed to have an empty $THRESHOLD, we append
+ # "--sensitivity $THRESHOLD" to $OPTIONS here only when it exists.
+ if [ ! -z "${THRESHOLD}" ] ; then
+ OPTIONS="${OPTIONS} --sensitivity ${THRESHOLD}"
+ fi
+
+ ebegin "Starting Hard Drive Active Protection System daemon"
+ start-stop-daemon --start --exec /usr/sbin/hdapsd \
+ --pidfile /var/run/hdapsd.pid \
+ -- --syslog --background --pidfile \
+ ${DISKOPTS} ${OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Hard Drive Active Protection System daemon"
+ start-stop-daemon --stop --exec /usr/sbin/hdapsd \
+ --pidfile /var/run/hdapsd.pid
+ eend $?
+}
--- /dev/null
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+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 kernel sources
+ # 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 (with hdaps USE enabled) or support for CONFIG_SENSORS_HDAPS enabled"
+ linux-info_pkg_setup
+ fi
+
+ DOC_CONTENTS="You can change the default frequency by modifing /sys/devices/platform/hdaps/sampling_rate.
+ You might need to enable shock protection manually by running:\n
+ # echo -1 > /sys/block/DEVICE/device/unload_heads"
+}
+
+src_configure(){
+ econf \
+ $(use_enable libconfig) \
+ --with-systemdsystemunitdir=$(systemd_get_unitdir) \
+ --docdir="${EROOT}usr/share/doc/${PF}"
+}
+
+src_install() {
+ default
+ newconfd "${FILESDIR}"/hdapsd.conf.3 hdapsd
+ newinitd "${FILESDIR}"/hdapsd.init.3 hdapsd
+ readme.gentoo_create_doc
+}
+
+pkg_postinst(){
+ [[ -z $(ls "${EROOT}"sys/block/*/queue/protect 2>/dev/null) ]] && \
+ [[ -z $(ls "${EROOT}"sys/block/*/device/unload_heads 2>/dev/null) ]] && \
+ ewarn "Your kernel does NOT support shock protection."
+
+ if ! has_version app-laptop/tp_smapi[hdaps]; then
+ ewarn "Using the hdaps module provided by app-laptop/tp_smapi instead"
+ ewarn "of the in-kernel driver is strongly recommended!"
+ fi
+
+ readme.gentoo_print_elog
+}
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>ottxor@gentoo.org</email>
+ <name>Christoph Junghans</name>
+ </maintainer>
+
+ <use>
+ <flag name='libconfig'>
+ Require <pkg>dev-libs/libconfig</pkg> to allow the daemon to
+ read a configuration file at startup
+ </flag>
+ </use>
+</pkgmetadata>