--- hdapsd-20090401.orig/debian/compat +++ hdapsd-20090401/debian/compat @@ -0,0 +1 @@ +7 --- hdapsd-20090401.orig/debian/init +++ hdapsd-20090401/debian/init @@ -0,0 +1,165 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: hdapsd +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: initscript to start hdapsd +# Description: This file starts the hdapsd daemon +### END INIT INFO + +# Author: Evgeni Golov + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="IBM Hard Disk Active Protection System (HDAPS) daemon" +NAME=hdapsd +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +START="no" +DISK="sda" +SENSITIVITY=15 +OPTIONS="" +FORCEENABLE="no" + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Do we really want to start the daemon? +[ "$START" = "yes" ] || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +DAEMON_ARGS="-p$PIDFILE -d $DISK -s $SENSITIVITY -b $OPTIONS" +if [ "$FORCEENABLE" = "yes" ]; then + DAEMON_ARGS="$DAEMON_ARGS -f" +fi + +# +# Function that checks if /sys/block/$DISK/queue/protect +# or /sys/block/$DISK/device/unload_heads exist +# +do_checkprotect() +{ + if [ ! -f /sys/block/$DISK/queue/protect -a ! -f /sys/block/$DISK/device/unload_heads ]; then + log_warning_msg "Not starting $NAME: neither /sys/block/$DISK/queue/protect nor /sys/block/$DISK/device/unload_heads do exist, please read /usr/share/doc/hdapsd/README.Debian" + exit 0 + fi +} + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGUSR1 to the daemon/service +# +do_pause() { + start-stop-daemon --stop --signal 10 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + do_checkprotect + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + pause) + [ "$VERBOSE" != no ] && log_daemon_msg "Pauseing (8sec) $DESC" "$NAME" + do_pause + ;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|pause}" >&2 + exit 3 + ;; +esac + +: --- hdapsd-20090401.orig/debian/control +++ hdapsd-20090401/debian/control @@ -0,0 +1,19 @@ +Source: hdapsd +Section: misc +Priority: optional +Maintainer: Evgeni Golov +Build-Depends: debhelper (>= 7) +Standards-Version: 3.9.1 + +Package: hdapsd +Architecture: i386 amd64 powerpc +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: tp-smapi-dkms [!powerpc] | tp-smapi-source [!powerpc] +Description: HDAPS daemon for IBM/Lenovo ThinkPads and Apple iBooks/PowerBooks + This is a disk protection user-space daemon. It monitors the acceleration + values through the HDAPS or AMS interface and automatically initiates disk + head parking if a fall or sliding of the laptop is detected. + . + It is recommended that you use this daemon with the hdaps module provided + by tp-smapi rather the one in the kernel, as this will save you a bit + power and will work on a wider range of ThinkPads. --- hdapsd-20090401.orig/debian/changelog +++ hdapsd-20090401/debian/changelog @@ -0,0 +1,142 @@ +hdapsd (1:20090401-2) unstable; urgency=low + + * debian/control: + + Update my email address. + + Remove DM-Upload-Allowed. + + Standards-Version: 3.9.1 + + Recommend tp-smapi-dkms | tp-smapi-source, there are no prebuilt + tp-smapi-modules packages anymore. + LP: #669176 + * debian/source/format: + + Add source format specification, 1.0 for now. + * debian/init: + + Add $remote_fs to the Required-Start and Required-Stop headers. + Thanks lintian! + + -- Evgeni Golov Mon, 13 Dec 2010 12:29:07 +0100 + +hdapsd (1:20090401-1) unstable; urgency=low + + * New upstream release. + * Upload to unstable again. + Closes: #519766 + * debian/control: + + Bump Standards-Version to 3.8.1, no changes needed. + + Add powerpc to Architecture - hdapsd runs on Apples now. + + Set DM-Upload-Allowed: yes. + + Update descriptions to mention Apple/AMS and delete the patch paragraph + as 2.6.28/2.6.29 is in Debian and supports head parking. + + Don't recommend tp-smapi on powerpc. + * debian/init: + + Don't try to modprobe hdaps - hdapsd does this in a better way. + + If FORCEENABLE=yes, just pass -f to hdapsd. + * debian/rules: + + Remove the udev file rename workaround. + * debian/preinst: + + Add code based on http://wiki.debian.org/DpkgConffileHandling to + remove old udev rules file. + + -- Evgeni Golov Thu, 02 Apr 2009 07:49:34 +0200 + +hdapsd (1:20090129-1) experimental; urgency=low + + * New upstream release. + + Adds support for multiple disks. LP: #154807 + + Adds support for logging to syslog. Closes: #510565 + * debian/control: + + Use debhelper 7. + + Add Depends on ${misc:Depends} as suggested by lintian. + + Aspell says it's user-space, not userspace. + * debian/hdapsd.{udev,8}: + + Remove the manpage and udev rule, they are installed by upstream now. + * debian/rules: + + Use debhelper 7. + * debian/compat: + + Bump to debhelper 7. + * debian/watch: + + Update the watchfile to reflect the new hosting at SF.net + * debian/copyright: + + Update copyright years and holders. + + -- Evgeni Golov Thu, 29 Jan 2009 21:14:55 +0100 + +hdapsd (1:0.0.20081004-1) experimental; urgency=low + + * New upstream release. + + Prepare for the new interface in kernel 2.6.28. + * debian/default: + + Set the default DISK to sda, as recent hardware is usually SATA. + + Add a FORCEENABLE option. + * debian/init: + + Check for the new interface before starting. + + Use the FORCEENABLE option. + * debian/NEWS: + + Remove it, as the info is not needed after Lenny anymore. + * debian/copyright: + + Convert to machine-readable format. + + Update the copyright dates. + * debian/rules: + + Don't set CFLAGS, let dpkg handle it. + + Don't use rm in the clean target, dh_clean is fine too. + * debian/control: + + Bump Standards-Version to 3.8.0, no changes needed. + + Remove the Depends on lsb-base, it's Priority: required and has a + high enough version since Etch. + * debian/README.Debian: + + Note that kernel 2.6.28 won't need a patch anymore. + + Reformat and rephrase the other information too. + + -- Evgeni Golov Thu, 13 Nov 2008 13:12:30 +0100 + +hdapsd (1:0.0.20070803-2) unstable; urgency=low + + * debian/init: + + Add a notice that the user should read /u/s/d/hdapsd/README.Debian + + * debian/control: + + Add a Recommends on tp-smapi-modules, as this is recommended instead + of the in-kernel hdaps module + + Explain the relationship to tp-smapi and the kernel-patch in the + long description (Closes: #468387) + + Bump Standards-Version to 3.7.3, no changes needed + + -- Evgeni Golov Thu, 06 Mar 2008 00:41:41 +0100 + +hdapsd (1:0.0.20070803-1) unstable; urgency=low + + * New upstream version (Closes: #435759) + * PID-option has to be -p/path/to/pid, without a space, thanks Whoopie + * Check if hdaps module is loaded, and try to do so if not + + -- Evgeni Golov Fri, 10 Aug 2007 12:06:40 +0200 + +hdapsd (1:0.0.20070524-1) unstable; urgency=low + + * New upstream version, fixing compile errors + + -- Evgeni Golov Fri, 25 May 2007 21:54:05 +0200 + +hdapsd (1:0.0.20070415-1) UNRELEASED; urgency=low + + * New upstream version, fixing one minor bug + * Using the "original" version by Jon Escombe again + * Added a watch-file + + -- Evgeni Golov Sun, 29 Apr 2007 22:47:52 +0200 + +hdapsd (1:0.0.20061007-2) unstable; urgency=low + + * Remove THRESHOLD variable from default-file, add OPTIONS instead + Thanks to Chris Hanson (Closes: #408906) + * Minor cleanups in the manpage + * Remove bashism in /etc/init.d/hdapsd (Closes: #408998) + + -- Evgeni Golov Mon, 29 Jan 2007 22:13:45 +0100 + +hdapsd (1:0.0.20061007-1) unstable; urgency=low + + * Initial release (Closes: #402908) + * Using epoch 1, so users with unofficial packages from Andrew Barr + notice the existence of this package + + -- Evgeni Golov Tue, 12 Dec 2006 10:44:31 +0100 --- hdapsd-20090401.orig/debian/default +++ hdapsd-20090401/debian/default @@ -0,0 +1,22 @@ +# hdapsd default file + +# start hdapsd at boottime? +START="yes" + +# the name of the disk device that hdapsd should monitor. +# +# usually this is 'hda' for the primary IDE master or 'sda' +# for the primary S-ATA drive +DISK="sda" + +# sensitivity +SENSITIVITY=15 + +# other options to pass to hdapsd. +# the -d $DISK, -s $SENSITIVITY, -b and -p $PIDFILE options are always passed. +OPTIONS="" + +# The new interface in kernels >=2.6.28 sometimes wrongly detects HDAPS-capable +# drives as not supported. Set this to "yes" to force-enable the feature. +# Please be carefull with this setting! +FORCEENABLE="no" --- hdapsd-20090401.orig/debian/copyright +++ hdapsd-20090401/debian/copyright @@ -0,0 +1,21 @@ +Format-Specification: + http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=233 +Upstream-Name: hdapsd +Upstream-Maintainer: Evgeni Golov +Upstream-Source: http://sf.net/projects/hdaps/ + +Files: * +Copyright: © 2005-2007 Jon Escombe +Copyright: © 2005-2007 Robert Love +Copyright: © 2005-2007 Shem Multinymous +Copyright: © 2008 Elias Oltmanns +Copyright: © 2008-2009 Evgeni Golov +License: GPL-2+ + +Files: debian/* +License: GPL-2+ +Copyright: 2006-2009 Evgeni Golov + +License: GPL-2+ + On Debian systems, the complete text of the GNU General Public License + can be found in `/usr/share/common-licenses/GPL'. --- hdapsd-20090401.orig/debian/rules +++ hdapsd-20090401/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f + +build: build-stamp +build-stamp: + dh build + touch build-stamp + +clean: + dh clean + +install: build + dh install --before dh_install + # Workaround for #513521 + $(RM) $(CURDIR)/debian/hdapsd/usr/share/doc/hdapsd/ChangeLog + # Fix a small typo in manpage (-d vs \-d) + sed -i -e 's/(-d/(\\-d/' $(CURDIR)/debian/hdapsd/usr/share/man/man8/hdapsd.8 + dh install --remaining + +binary-arch: install + dh binary-arch + +binary-indep: install + dh binary-indep + +binary: binary-arch binary-indep --- hdapsd-20090401.orig/debian/README.Debian +++ hdapsd-20090401/debian/README.Debian @@ -0,0 +1,33 @@ +hdapsd for Debian +----------------- + +hdapsd with kernels <= 2.6.27 +============================= + +Linux kernels <= 2.6.27 have no built-in interface for parking the heads. +Thus, hdapsd needs a kernel patch to be able to protect your drive. +You can find such patches and further information in the ThinkWiki[1]. + +hdapsd with kernels >= 2.6.28 +============================= + +Since kernel 2.6.28, there is an interface for parking the heads, so no +patch is needed anymore. +However, kernels >= 2.6.28 only enable this interface for ATA-7 drives. +IBM/Lenovo has shipped ATA-6 drives with modified firmware and +"IDLE_IMMEDIATE with UNLOAD" support, these drives need FORCEENABLE="yes" +in /etc/default/hdapsd to work. +For additional information, read the ThinkWiki[1] and the docs in the +kernel source[2]. + +tp-smapi +======== + +For reading the accelerometer, hdapsd needs the hdaps module. +There is one in the kernel, but it is recommended to use the one from +tp-smapi, as it supports more hardware and has a less power-hungry design. + +[1] http://thinkwiki.org/wiki/HDAPS +[2] Documentation/laptops/disk-shock-protection.txt + + -- Evgeni Golov Thu, 13 Nov 2008 13:09:18 +0100 --- hdapsd-20090401.orig/debian/watch +++ hdapsd-20090401/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/hdaps/hdapsd-(\d+)\.tar.gz --- hdapsd-20090401.orig/debian/preinst +++ hdapsd-20090401/debian/preinst @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +# Remove a no-longer used conffile +rm_conffile() { + PKGNAME="$1" + CONFFILE="$2" + if [ -e "$CONFFILE" ]; then + md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" + old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`" + if [ "$md5sum" != "$old_md5sum" ]; then + echo "Obsolete conffile $CONFFILE has been modified by you." + echo "Saving as $CONFFILE.dpkg-bak ..." + mv -f "$CONFFILE" "$CONFFILE".dpkg-bak + else + echo "Removing obsolete conffile $CONFFILE ..." + rm -f "$CONFFILE" + fi + fi +} +case "$1" in +install|upgrade) + if dpkg --compare-versions "$2" le "1:20090129-1"; then + rm_conffile hdapsd "/etc/udev/rules.d/z60_hdapsd.rules" + fi +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + --- hdapsd-20090401.orig/debian/source/format +++ hdapsd-20090401/debian/source/format @@ -0,0 +1 @@ +1.0