From 22c3213965d01bf3004025f206fff8b90e2738c8 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 26 Jun 2006 20:07:24 +0000 Subject: Initial import based on the work by Michael Gaber and Jeff Grafton, #119845. (Portage version: 2.1.1_pre1-r2) --- app-laptop/hdapsd/ChangeLog | 9 +++ app-laptop/hdapsd/Manifest | 25 ++++++++ app-laptop/hdapsd/files/digest-hdapsd-20060409 | 6 ++ app-laptop/hdapsd/files/hdapsd.conf | 11 ++++ app-laptop/hdapsd/files/hdapsd.init | 49 +++++++++++++++ app-laptop/hdapsd/hdapsd-20060409.ebuild | 84 ++++++++++++++++++++++++++ app-laptop/hdapsd/metadata.xml | 11 ++++ 7 files changed, 195 insertions(+) create mode 100644 app-laptop/hdapsd/ChangeLog create mode 100644 app-laptop/hdapsd/Manifest create mode 100644 app-laptop/hdapsd/files/digest-hdapsd-20060409 create mode 100644 app-laptop/hdapsd/files/hdapsd.conf create mode 100644 app-laptop/hdapsd/files/hdapsd.init create mode 100644 app-laptop/hdapsd/hdapsd-20060409.ebuild create mode 100644 app-laptop/hdapsd/metadata.xml (limited to 'app-laptop') diff --git a/app-laptop/hdapsd/ChangeLog b/app-laptop/hdapsd/ChangeLog new file mode 100644 index 000000000000..30e0fd818f74 --- /dev/null +++ b/app-laptop/hdapsd/ChangeLog @@ -0,0 +1,9 @@ +# ChangeLog for app-laptop/hdapsd +# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/ChangeLog,v 1.1 2006/06/26 20:07:24 uberlord Exp $ + +*hdapsd-20060409 (26 Jun 2006) + + 26 Jun 2006; Roy Marples +files/hdapsd.conf, + +files/hdapsd.init, +metadata.xml, +hdapsd-20060409.ebuild: + Initial import based on the work by Michael Gaber and Jeff Grafton, #119845. diff --git a/app-laptop/hdapsd/Manifest b/app-laptop/hdapsd/Manifest new file mode 100644 index 000000000000..d5e71e98807b --- /dev/null +++ b/app-laptop/hdapsd/Manifest @@ -0,0 +1,25 @@ +AUX hdapsd.conf 321 RMD160 5bb760d34bca3f5a12aeb057b78de7e2a9065bc3 SHA1 ade013dab6278a385b4658aad7e871b743380689 SHA256 22e1acf385427052a12858db005fd73d42d9f6818fb253b032cd326101df2e34 +MD5 ef4095f13d4c1a5363c3ed2e0528bd08 files/hdapsd.conf 321 +RMD160 5bb760d34bca3f5a12aeb057b78de7e2a9065bc3 files/hdapsd.conf 321 +SHA256 22e1acf385427052a12858db005fd73d42d9f6818fb253b032cd326101df2e34 files/hdapsd.conf 321 +AUX hdapsd.init 1201 RMD160 c3034ecda4674ed3b6143b6dd7a93affe5d7ee3c SHA1 da31da30c14f66d178d32fd0f2b547a2cef3f212 SHA256 1d14fe6d0ade3651c259d4e438d5aa031aa9444086d3fbb0187dbcb7b3ce337e +MD5 537c9631beaf73f0db48efc4a5686f48 files/hdapsd.init 1201 +RMD160 c3034ecda4674ed3b6143b6dd7a93affe5d7ee3c files/hdapsd.init 1201 +SHA256 1d14fe6d0ade3651c259d4e438d5aa031aa9444086d3fbb0187dbcb7b3ce337e files/hdapsd.init 1201 +DIST hdaps_protect-patches-1.tar.bz2 6179 RMD160 5b173034eebbbee598e01d45e5e76e2859c0a829 SHA1 7d79652ddc884b6619944a0d9ed70557e9c56779 SHA256 ab4192fa3a26497fe9fed63bfaedfebc74d288a85e7283b1bc338984be1133dd +DIST hdapsd-20060409.c.bz2 5253 RMD160 0b8d07a2612bd4888014913bd8810de664352bfb SHA1 df6c5bf28d4539e97bb1800a455a36cf690d4779 SHA256 e8e1788d485814cd294c33744b60265423d8971abf5ab50b037f05de2c710a21 +EBUILD hdapsd-20060409.ebuild 2177 RMD160 c1c4eaae9e553a2cebd84dda6aa0363fe669462a SHA1 e80da09e8f14532aa019367c5a63b99a40a9ef1f SHA256 47a1539a0c83eaf6911ed51f219f2e75a79773c3f9963c4a8ae865c94105d332 +MD5 902522ecf6f3ba251e2e7d305a6108ec hdapsd-20060409.ebuild 2177 +RMD160 c1c4eaae9e553a2cebd84dda6aa0363fe669462a hdapsd-20060409.ebuild 2177 +SHA256 47a1539a0c83eaf6911ed51f219f2e75a79773c3f9963c4a8ae865c94105d332 hdapsd-20060409.ebuild 2177 +MISC ChangeLog 360 RMD160 de6e2ef2d7064c26007f97a7078593ba146d06f0 SHA1 866b6b5c3f0483b3c65018321058460867486f72 SHA256 578e65f3798eb001f5bb3c958150958fbfb0968cd32497e370de6b4d3c022e79 +MD5 632618f33f80a6524c3a5494e63d768e ChangeLog 360 +RMD160 de6e2ef2d7064c26007f97a7078593ba146d06f0 ChangeLog 360 +SHA256 578e65f3798eb001f5bb3c958150958fbfb0968cd32497e370de6b4d3c022e79 ChangeLog 360 +MISC metadata.xml 356 RMD160 140232e3535cb4f3eecb376611b3419519b4b260 SHA1 2563060180594d039fa175a73a8437bc13af5660 SHA256 29a57a39b3a1fdf3091c4012b4161c27b043da505743cf665860527545a9a1fa +MD5 29203234d07d55e82b92c297ab988473 metadata.xml 356 +RMD160 140232e3535cb4f3eecb376611b3419519b4b260 metadata.xml 356 +SHA256 29a57a39b3a1fdf3091c4012b4161c27b043da505743cf665860527545a9a1fa metadata.xml 356 +MD5 c92320b8f991d8345345eceafb29d0a9 files/digest-hdapsd-20060409 506 +RMD160 11a06bc2bcb655211ed3fe74d7a8675d98bc0a5b files/digest-hdapsd-20060409 506 +SHA256 816c22ded32067fbf9e200c293b5294d64a128d73eada333aaa68198e8455e09 files/digest-hdapsd-20060409 506 diff --git a/app-laptop/hdapsd/files/digest-hdapsd-20060409 b/app-laptop/hdapsd/files/digest-hdapsd-20060409 new file mode 100644 index 000000000000..2e48b8e201e9 --- /dev/null +++ b/app-laptop/hdapsd/files/digest-hdapsd-20060409 @@ -0,0 +1,6 @@ +MD5 7ccac69e3c1a6134117f6cdb3e5deeef hdaps_protect-patches-1.tar.bz2 6179 +RMD160 5b173034eebbbee598e01d45e5e76e2859c0a829 hdaps_protect-patches-1.tar.bz2 6179 +SHA256 ab4192fa3a26497fe9fed63bfaedfebc74d288a85e7283b1bc338984be1133dd hdaps_protect-patches-1.tar.bz2 6179 +MD5 ef8bf36c67e2aee8914be178012b3861 hdapsd-20060409.c.bz2 5253 +RMD160 0b8d07a2612bd4888014913bd8810de664352bfb hdapsd-20060409.c.bz2 5253 +SHA256 e8e1788d485814cd294c33744b60265423d8971abf5ab50b037f05de2c710a21 hdapsd-20060409.c.bz2 5253 diff --git a/app-laptop/hdapsd/files/hdapsd.conf b/app-laptop/hdapsd/files/hdapsd.conf new file mode 100644 index 000000000000..622190954c74 --- /dev/null +++ b/app-laptop/hdapsd/files/hdapsd.conf @@ -0,0 +1,11 @@ +# The name of the disk device that hdapsd should monitor. +# Usually this is 'hda' or 'sda' the primary master. +DISK="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 b/app-laptop/hdapsd/files/hdapsd.init new file mode 100644 index 000000000000..00609c1cfac9 --- /dev/null +++ b/app-laptop/hdapsd/files/hdapsd.init @@ -0,0 +1,49 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 + +depend() { + need localmount +} + +checkconfig() { + if [[ -z ${DISK} || -z ${THRESHOLD} ]] ; then + eerror "You should setup DISK and THRESHOLD in /etc/conf.d/hdapsd." + return 1 + fi + + if [[ ! -e /sys/block/${DISK}/queue/protect ]] ; then + eerror "No protect entry for ${DISK}!" + eerror "Make sure your kernel is patched with the blk_freeze patch" + return 1 + fi + + # Load the tp_smapi module first + # This is not a requirement, but it helps hdapsd adaptive mode + if [[ ! -e /sys/devices/platorm/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 + + ebegin "Starting hdapsd" + start-stop-daemon --start --exec /usr/sbin/hdapsd \ + --pidfile /var/run/hdapsd.pid \ + -- -b -p -d "${DISK}" -s "${THRESHOLD}" ${OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping hdaps daemon" + start-stop-daemon --stop --exec /usr/sbin/hdapsd \ + --pidfile /var/run/hdapsd.pid + eend $? +} diff --git a/app-laptop/hdapsd/hdapsd-20060409.ebuild b/app-laptop/hdapsd/hdapsd-20060409.ebuild new file mode 100644 index 000000000000..588aeaf51877 --- /dev/null +++ b/app-laptop/hdapsd/hdapsd-20060409.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-laptop/hdapsd/hdapsd-20060409.ebuild,v 1.1 2006/06/26 20:07:24 uberlord Exp $ + +inherit eutils linux-info + +PROTECT_VER="1" + +DESCRIPTION="IBM ThinkPad Harddrive Active Protection disk head parking daemon" +HOMEPAGE="http://hdaps.sourceforge.net/" +SRC_URI="mirror://gentoo/${P}.c.bz2 + mirror://gentoo/hdaps_protect-patches-${PROTECT_VER}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" + +IUSE="" +RDEPEND="" + +S="${WORKDIR}" + +CONFIG_CHECK="SENSORS_HDAPS" +ERROR_NET_RADIO="${P} requires support for HDAPS (CONFIG_SENSORS_HDAPS)" + +src_compile() { + cd "${WORKDIR}" + gcc ${CFLAGS} "${P}".c -o hdapsd || die "failed to compile" +} + +src_install() { + dosbin "${WORKDIR}"/hdapsd + newconfd "${FILESDIR}"/hdapsd.conf hdapsd + newinitd "${FILESDIR}"/hdapsd.init hdapsd + + # Install our kernel patches + dodoc *.patch +} + +kernel_patched() { + get_version + + if grep -qs "blk_protect_register" "${KERNEL_DIR}"/block/ll_rw_blk.c ; then + einfo "Your kernel has already been patched for blk_freeze" + return 0 + fi + + return 1 +} + +pkg_config() { + kernel_patched && return 0 + + local docdir="${ROOT}/usr/share/doc/${PF}/" + local p="hdaps_protect-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.patch.gz" + + # We need to find our FILESDIR as it's now lost + if [[ ! -e ${docdir}/${p} ]] ; then + ewarn "We don't have a patch for kernel ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} yet" + return 1 + fi + + cd "${KERNEL_DIR}" + epatch "${docdir}/${p}" +} + +pkg_postinst(){ + einfo "If you use syslog-ng you might want to add the following " + einfo "to /etc/syslog-ng/syslog-ng.conf to prevent your logfile" + einfo "getting flooded with the output of hdapsd:" + einfo "filter f_not_hdapsd { not match(queue_protect_store)" + einfo " and not match(idedisk_issue_protect_fn)" + einfo " and not match (ide_protect_queue);" + einfo "};" + einfo "log { source(src); filter(f_not_hdapsd); destination(messages); };" + einfo "log { source(src); destination(console_all); };" + + echo + if ! kernel_patched ; then + ewarn "Your kernel has NOT been patched for blk_freeze" + einfo "The ebuild can attempt to patch your kernel like so" + einfo " emerge --config =${PF}" + fi +} diff --git a/app-laptop/hdapsd/metadata.xml b/app-laptop/hdapsd/metadata.xml new file mode 100644 index 000000000000..ed8a22548bc2 --- /dev/null +++ b/app-laptop/hdapsd/metadata.xml @@ -0,0 +1,11 @@ + + + + mobile + + uberlord@gentoo.org + Roy Marples + + IBM ThinkPad Harddrive Active Protection disk head parking + daemon + -- cgit v1.2.3-65-gdbad