diff -u laptop-mode-tools-1.34/etc/init.d/laptop-mode laptop-mode-tools-1.34/etc/init.d/laptop-mode --- laptop-mode-tools-1.34/etc/init.d/laptop-mode +++ laptop-mode-tools-1.34/etc/init.d/laptop-mode @@ -22,6 +22,17 @@ . /lib/lsb/init-functions +if [ -f /etc/default/laptop-mode ]; then + . /etc/default/laptop-mode; +fi +if [ -f /etc/default/acpi-support ]; then + . /etc/default/acpi-support; +fi + +if [ x$ENABLE_LAPTOP_MODE = xfalse ]; then + exit 0; +fi + # Enable laptop mode when the system is booted when running on battery. TEMPFILE=`mktemp` diff -u laptop-mode-tools-1.34/debian/changelog laptop-mode-tools-1.34/debian/changelog --- laptop-mode-tools-1.34/debian/changelog +++ laptop-mode-tools-1.34/debian/changelog @@ -1,3 +1,22 @@ +laptop-mode-tools (1.34-1ubuntu1) gutsy; urgency=low + + * Merge from debian unstable, remaining changes: + - etc/init.d/laptop-mode: Check if laptop mode is disabled in + /etc/default/laptop-mode (that's the file laptop_mode looks into, too, + but it incorrectly evaluates the ENABLE_LAPTOP_MODE setting) as well + as in /etc/default/acpi-support. + - Add debian/laptop-mode-tools.postinst: Create /etc/default/laptop-mode + (with ENABLE_LAPTOP_MODE=false) if the file does not exist yet and we + are on ppc. + - /usr/sbin/laptop_mode: Do not parse arguments, ignore "force" and + "init" and let start/stop mean enable/disable. + - /usr/sbin/laptop_mode: Do not read $ACTIVATE_WITH_POSSIBLE_DATA_LOSS + from /var/run/laptop-mode-state to see if state has changed. + * Fix error messages when run as non-root (Ubuntu bug #77560). Patch from + Peter Whittaker. + + -- Tormod Volden Wed, 30 May 2007 22:30:20 +0100 + laptop-mode-tools (1.34-1) unstable; urgency=low * New upstream version 1.34. @@ -32,6 +51,12 @@ -- Bart Samwel Sat, 19 May 2007 20:00:00 +0100 +laptop-mode-tools (1.32-1ubuntu1) feisty; urgency=low + + * Merge from debian unstable; remaining Ubuntu changes: + + -- Martin Pitt Wed, 6 Dec 2006 12:53:23 +0100 + laptop-mode-tools (1.32-1) unstable; urgency=low * New upstream version 1.32. @@ -41,6 +66,40 @@ -- Bart Samwel Fri, 6 Oct 2006 12:00:00 +0200 +laptop-mode-tools (1.31-1ubuntu4) edgy; urgency=low + + * Disable laptop mode by default on powerpc. On i386/amd64 is disabled by + default in /etc/default/acpi-support), but acpi-support does not exist on + powerpc. This will prevent 'kill my hard disk' bugs like #29529 to happen + to users who are unaware of laptop-mode. + - etc/init.d/laptop-mode: Check if laptop mode is disabled in + /etc/default/laptop-mode (that's the file laptop_mode looks into, too, + but it incorrectly evaluates the ENABLE_LAPTOP_MODE setting). + - Add debian/laptop-mode-tools.postinst: Create /etc/default/laptop-mode + (with ENABLE_LAPTOP_MODE=false) if the file does not exist yet and we + are on ppc. + + -- Martin Pitt Fri, 6 Oct 2006 14:26:51 +0200 + +laptop-mode-tools (1.31-1ubuntu3) edgy; urgency=low + + * Remove debugging spew + + -- Matthew Garrett Wed, 20 Sep 2006 21:16:09 +0100 + +laptop-mode-tools (1.31-1ubuntu2) edgy; urgency=low + + * Beat up laptop_mode until it does what we want it to (ie, start or + stop based on our instructions, not depending on its own ideas) + + -- Matthew Garrett Wed, 20 Sep 2006 21:14:30 +0100 + +laptop-mode-tools (1.31-1ubuntu1) edgy; urgency=low + + * Sync with Debian. + + -- Tollef Fog Heen Mon, 10 Jul 2006 13:42:58 +0200 + laptop-mode-tools (1.31-1) unstable; urgency=low * New upstream version 1.31. @@ -130,6 +189,26 @@ -- Bart Samwel Wed, 25 Jan 2006 16:50:00 +0200 +laptop-mode-tools (1.11-1ubuntu3) dapper; urgency=low + + * Don't start laptop-mode on startup if it's disabled in the global + config + * Fix typo that prevented CPU governor setting + + -- Matthew Garrett Fri, 5 May 2006 20:47:05 +0100 + +laptop-mode-tools (1.11-1ubuntu2) dapper; urgency=low + + * Disable write caching by default + + -- Matthew Garrett Sun, 30 Apr 2006 19:11:00 +0100 + +laptop-mode-tools (1.11-1ubuntu1) dapper; urgency=low + + * Don't ship acpi scripts (we handle that ourselves) + + -- Matthew Garrett Tue, 29 Nov 2005 17:27:51 +0000 + laptop-mode-tools (1.11-1) unstable; urgency=low * New upstream version 1.11. @@ -187,7 +266,7 @@ * Fixes breakage caused by 1.06 release. -- Bart Samwel Fri, 29 Jul 2005 19:18:00 +0200 - + laptop-mode-tools (1.06-1) unstable; urgency=low * New upstream version 1.06. diff -u laptop-mode-tools-1.34/debian/control laptop-mode-tools-1.34/debian/control --- laptop-mode-tools-1.34/debian/control +++ laptop-mode-tools-1.34/debian/control @@ -1,7 +1,8 @@ Source: laptop-mode-tools Section: utils Priority: optional -Maintainer: Bart Samwel +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Bart Samwel Build-Depends: debhelper (>= 4.0.0) Standards-Version: 3.6.2.1 only in patch2: unchanged: --- laptop-mode-tools-1.34.orig/debian/laptop-mode-tools.postinst +++ laptop-mode-tools-1.34/debian/laptop-mode-tools.postinst @@ -0,0 +1,10 @@ +#!/bin/sh -e + +if [ "$1" = configure ]; then + # create a default file for disabling laptop-mode on powerpc, since there + # is no acpi-support package to do it for us + F=/etc/default/laptop-mode + if [ ! -e $F ] && [ "`uname -m`" = ppc ]; then + echo 'ENABLE_LAPTOP_MODE=false' > $F + fi +fi only in patch2: unchanged: --- laptop-mode-tools-1.34.orig/usr/sbin/laptop_mode +++ laptop-mode-tools-1.34/usr/sbin/laptop_mode @@ -340,14 +340,24 @@ mount | sed "s/^/ /" echo echo Drive power status: - hdparm -C $HD 2>/dev/null | sed "s/^/ /" + for disk in $HD; do + if [ -r $disk ]; then + hdparm -C $disk 2>/dev/null | sed "s/^/ /" + else + echo " Cannot read $disk, permission denied - run $0 with sudo" + fi + done echo echo "(NOTE: drive settings affected by Laptop Mode cannot be retrieved.)" echo echo Readahead states: cat /etc/mtab | while read DEV MP FST OPTS DUMP PASS ; do if [ -b $DEV ] ; then - echo " $DEV: $((`/sbin/blockdev --getra $DEV` / 2)) kB" + if [ -r $DEV ] ; then + echo " $DEV: $((`blockdev --getra $DEV` / 2)) kB" + else + echo " Cannot read $DEV, permission denied - run $0 with sudo" + fi fi done echo @@ -364,7 +374,7 @@ if [ -r $THISFILE ] ; then cat $THISFILE | sed "s/^/ /" else - echo " Not accessible: permissions problem?" + echo " Not accessible: permissions problem? Run $0 with sudo" fi echo fi @@ -515,20 +525,20 @@ INIT=0 # Display info in init script format? FORCE=0 # Force reapplying the current state? -while [ "$1" != "" ] ; do - case "$1" in - init) INIT=1 ;; - force) FORCE=1 ;; - # Old options. We always do "auto" for any option now, but - # we still have to accept the options. - start) ;; - stop) ;; - auto) ;; - *) echo "Unrecognized option $1." - exit 1 ;; - esac - shift -done +#while [ "$1" != "" ] ; do +# case "$1" in +# init) INIT=1 ;; +# force) FORCE=1 ;; +# # Old options. We always do "auto" for any option now, but +# # we still have to accept the options. +# start) ;; +# stop) ;; +# auto) ;; +# *) echo "Unrecognized option $1." +# exit 1 ;; +# esac +# shift +#done # Used to display laptop mode state later on. This is the enabled/disabled # state for laptop mode processing, it tells us nothing about whether laptop @@ -627,8 +637,12 @@ fi fi -if [ "$STATE" == "disabled" ] ; then - ACTIVATE=0 +if [ "$1" == "start" ]; then + STATE=enabled + ACTIVATE=1; +elif [ "$1" == "stop" ]; then + STATE=disabled + ACTIVATE=0; fi # Check whether we are allowed to activate the data-loss-sensitive stuff. @@ -783,31 +797,6 @@ # WAS_ACTIVE is used later on. If there is no /var/run/laptop-mode-state, then # we know that laptop mode wasn't active before. WAS_ACTIVE=0 -echo Checking if desired state is different from current state. >> $OUTPUT -if [ -f /var/run/laptop-mode-state ] ; then - read WAS_ACTIVE WAS_ON_AC WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS < /var/run/laptop-mode-state - if [ "$WAS_ON_AC" != "" ] ; then - if [ "$WAS_ACTIVE" -eq "$ACTIVATE" -a "$WAS_ON_AC" -eq "$ON_AC" -a "$WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -eq "$ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -a "$FORCE" -eq 0 ] ; then - echo -n "$STATE, " - if [ "$WAS_ACTIVE" -eq 1 ] ; then - echo -n "active [unchanged]" - if [ "$ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -eq 0 ] ; then - echo -n ' (Data-loss sensitive features disabled.)' - fi - echo - else - echo "not active [unchanged]" - fi - exit 0 - fi - else - echo "/var/run/laptop-mode-state in pre-1.20 format, ignoring previous state." >> $OUTPUT - WAS_ACTIVE=0 - fi -else - echo "/var/run/laptop-mode-state does not exist, no previous state." >> $OUTPUT -fi -echo $ACTIVATE $ON_AC $ACTIVATE_WITH_POSSIBLE_DATA_LOSS > /var/run/laptop-mode-state if [ "$ACTIVATE" -eq 1 ] ; then echo -n "$STATE, active."