fixed bug #334435 and bug #392475
authorChristoph Junghans <ottxor@gentoo.org>
Wed, 21 Dec 2011 04:51:22 +0000 (04:51 +0000)
committerChristoph Junghans <ottxor@gentoo.org>
Wed, 21 Dec 2011 04:51:22 +0000 (04:51 +0000)
Package-Manager: portage-2.2.0_alpha81/cvs/Linux i686

app-laptop/hdapsd/ChangeLog
app-laptop/hdapsd/Manifest
app-laptop/hdapsd/files/hdapsd.conf.2 [new file with mode: 0644]
app-laptop/hdapsd/files/hdapsd.init.2 [new file with mode: 0644]
app-laptop/hdapsd/hdapsd-20090401-r1.ebuild [new file with mode: 0644]

index ba824360ae2226510077ad9a88430620362583bf..69175abd0b82982269ffb50b4b380b74c22aafdf 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for app-laptop/hdapsd
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/ChangeLog,v 1.17 2011/05/04 15:44:37 tomka Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/ChangeLog,v 1.18 2011/12/21 04:51:22 ottxor Exp $
+
+*hdapsd-20090401-r1 (21 Dec 2011)
+
+  21 Dec 2011; Christoph Junghans <ottxor@gentoo.org>
+  +hdapsd-20090401-r1.ebuild, +files/hdapsd.conf.2, +files/hdapsd.init.2:
+  fixed bug #334435 and bug #392475
 
   04 May 2011; Thomas Kahle <tomka@gentoo.org> hdapsd-20090401.ebuild:
   x86 stable per bug 334737
index 17e645d8d9ce7e91d67e04840e0f85a30f13703b..e1ed3cfe5c6a440333de728c18a93e3f377dab12 100644 (file)
@@ -1,16 +1,23 @@
 -----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
+Hash: SHA1
 
 AUX hdapsd.conf 321 RMD160 5bb760d34bca3f5a12aeb057b78de7e2a9065bc3 SHA1 ade013dab6278a385b4658aad7e871b743380689 SHA256 22e1acf385427052a12858db005fd73d42d9f6818fb253b032cd326101df2e34
+AUX hdapsd.conf.2 318 RMD160 943cb0d6150f058aa08d4413518b03f1957d6cfe SHA1 a30210840df2e9d2e6b218e56554fcc1dacce451 SHA256 231dfd170e5ced54ed6ba8e64a72ef325deac478c192e7354e594c4c33bb7a95
 AUX hdapsd.init 1474 RMD160 eb95d5cab723e404a33a5a982bb6be14e232925f SHA1 7cb50b75884f85dee916d7209529fdf0859d8bab SHA256 cfb13ec173f61da633febb2442b6db6be5ba0433f4b2cff0c370cce916e150d7
+AUX hdapsd.init.2 1854 RMD160 4382cb7f43d9140326512dd1b54930f7ebb4cba4 SHA1 31d83152613f6b867673bf3116b81d838b9def95 SHA256 5f1fe222429de7cdce16d408ab358e367ce5091e1df6f977df31d20e3ab510cf
 DIST hdapsd-20090401.tar.gz 95058 RMD160 e4840a4a6be24e8a950c6f6e6c5a2dc36604868e SHA1 0d6517d36a0da8d5e765e5bc3059bad5d19a7e72 SHA256 32979d58de4c54a7cc5671e7e7b4f0b653b659104faa9610433f8bb5dd4cef7a
+EBUILD hdapsd-20090401-r1.ebuild 1725 RMD160 63dfe61b985677e785e4f7dfdd239d7e9ae4faf1 SHA1 1149a64ae1bada32b69cc2010d82250fa10df0ec SHA256 e86a614df057d593de16cddbd1aa071befc9fbb0db77b6549cb628c5cf500c73
 EBUILD hdapsd-20090401.ebuild 1741 RMD160 9f085bf1c3c136e6787314aaf7a757cc7caf8064 SHA1 e4cd1d9d1fd68be7834c687be329d6b83d3080e5 SHA256 432285aed9ad35eeb7e703421e3f21204e49a8e137ef32e5d2cb4dcb879c6969
-MISC ChangeLog 2671 RMD160 18608a79e24b09d7375078e334a0e59253abe34b SHA1 f842d0d0879bff01f2853e64c1265cc1e773a3b2 SHA256 3766e6cdb3bae7808f42c5926931df51114ebaeedfebad4dfa5cfc8de378dd92
+MISC ChangeLog 2872 RMD160 c0379e8cb9786a66a85285d6cf3e82b4c013be97 SHA1 0777111f10c30c4cef86799e15ff6c0376b66399 SHA256 ba9481fb712bb5c67b82e003cf8ef31785860c6846065a0c54525caeefcbd86a
 MISC metadata.xml 263 RMD160 97c8ad544063bcbdf65190404934923e0a42d562 SHA1 6e276e4277eeae8ee686d0c858761aa63bf71e0b SHA256 0d5fcdbefefdc4a8d5d703b5a01a74e1bcf181cb3bd29fd82e202221795e51c2
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (GNU/Linux)
 
-iF4EAREIAAYFAk3BdSwACgkQodBTJSDyo64qSgD7B6sMlFoJ1B0tWhZv+kTHLqCJ
-NfdjiVdi3NpPmZHD8mYA/ivITLHUJEgp3xnA2kYeFcSrQiOoCfpgTYXYBNumQxvG
-=RnXZ
+iQEcBAEBAgAGBQJO8WXQAAoJEOeBhlrCAAWGgbgH/2cLMhyVBvtsqw+1FuO5MKPy
+3u58tVnClJHne8XbdWIccEzfkusfWTFGVUi4C5Nd1nruTC5aqg+AObLIIKt3yOng
+vI4c7SUq90IDxj3CwtPIRt+vxHDfBKZgD8F7e0uzQ8fCvxBkFjN1079vHy2ar8BS
+U3hKeOFoMJ7ux6Mx12TM5WI1AOQJsmXHx7HGk3nUrYRPRWMaTJAXW9FeSbRkBheh
+3tcVtkSyrTqTI9m9ex5JwG2ChZtHacH+lQK4fK9+VTG1hft1WTl+QtCH5o5dTlNB
+H7ejOdug5DidTOjY9xEmshoTb6rLI9FX2jAYrhTq8ELS4nvzmEmWR3ZrwTZtw9E=
+=OSWs
 -----END PGP SIGNATURE-----
diff --git a/app-laptop/hdapsd/files/hdapsd.conf.2 b/app-laptop/hdapsd/files/hdapsd.conf.2
new file mode 100644 (file)
index 0000000..2f55a83
--- /dev/null
@@ -0,0 +1,11 @@
+# The list of the disk devices that hdapsd should monitor.
+# Usually this is 'hda', 'sda' or 'hda sda'.
+DISKLIST="sda"
+
+# hdapsd sensitivity 
+# The lower the threshold is the earlier 
+# the heads are parked when the laptop is shaked
+THRESHOLD="10"
+
+# Set any extra options here, like -a for Adaptive mode
+OPTIONS="-a"
diff --git a/app-laptop/hdapsd/files/hdapsd.init.2 b/app-laptop/hdapsd/files/hdapsd.init.2
new file mode 100644 (file)
index 0000000..579c229
--- /dev/null
@@ -0,0 +1,68 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+
+depend() {
+    need localmount
+}
+
+checkconfig() {
+    if [[ -n ${DISK} ]]; then
+       ewarn "Please migrate DISK to DISKLIST in /etc/conf.d/hdapsd."
+       DISKLIST=${DISK}
+    fi
+
+    if [[ -z ${DISKLIST} || -z ${THRESHOLD} ]] ; then
+       eerror "You should setup DISKLIST and THRESHOLD in /etc/conf.d/hdapsd."
+       return 1
+    fi
+
+    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 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="-d ${DISK} "
+    done
+
+    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} --sensitivity "${THRESHOLD}" ${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 $?
+}
diff --git a/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild b/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild
new file mode 100644 (file)
index 0000000..d4774ce
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/hdapsd-20090401-r1.ebuild,v 1.1 2011/12/21 04:51:22 ottxor Exp $
+
+EAPI=4
+inherit linux-info
+
+DESCRIPTION="IBM ThinkPad Harddrive Active Protection disk head parking daemon"
+HOMEPAGE="http://hdaps.sourceforge.net/"
+SRC_URI="mirror://sourceforge/hdaps/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+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
+}
+
+src_install() {
+       emake DESTDIR="${ED}" install
+       rm -rf "${ED}"/usr/share/doc/hdapsd
+       dodoc ChangeLog README AUTHORS
+       newconfd "${FILESDIR}"/hdapsd.conf.2 hdapsd
+       newinitd "${FILESDIR}"/hdapsd.init.2 hdapsd
+}
+
+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. Kernel 2.6.28 and above is recommended!"
+
+       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
+
+       elog "You can change the default frequency by modifing /sys/devices/platform/hdaps/sampling_rate"
+       elog "You might need to enable shock protection manually by running "
+       elog "   echo -1 > /sys/block/DEVICE/device/unload_heads"
+}