diff -u laptop-mode-tools-1.35/etc/init.d/laptop-mode laptop-mode-tools-1.35/etc/init.d/laptop-mode --- laptop-mode-tools-1.35/etc/init.d/laptop-mode +++ laptop-mode-tools-1.35/etc/init.d/laptop-mode @@ -23,6 +23,17 @@ . /lib/lsb/init-functions TEMPFILE=`mktemp` +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. case $1 in diff -u laptop-mode-tools-1.35/usr/sbin/laptop_mode laptop-mode-tools-1.35/usr/sbin/laptop_mode --- laptop-mode-tools-1.35/usr/sbin/laptop_mode +++ laptop-mode-tools-1.35/usr/sbin/laptop_mode @@ -525,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 mkdir -p /var/run/laptop-mode-tools @@ -639,8 +639,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. @@ -795,28 +799,28 @@ # WAS_ACTIVE is used later on. If there is no /var/run/laptop-mode-tools/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-tools/state ] ; then - read WAS_ACTIVE WAS_ON_AC WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS < /var/run/laptop-mode-tools/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 - fi -else - echo "/var/run/laptop-mode-tools/state does not exist, no previous state." >> $OUTPUT -fi -echo $ACTIVATE $ON_AC $ACTIVATE_WITH_POSSIBLE_DATA_LOSS > /var/run/laptop-mode-tools/state +#echo Checking if desired state is different from current state. >> $OUTPUT +#if [ -f /var/run/laptop-mode-tools/state ] ; then +# read WAS_ACTIVE WAS_ON_AC WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS < /var/run/laptop-mode-tools/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 +# fi +#else +# echo "/var/run/laptop-mode-tools/state does not exist, no previous state." >> $OUTPUT +#fi +#echo $ACTIVATE $ON_AC $ACTIVATE_WITH_POSSIBLE_DATA_LOSS > /var/run/laptop-mode-tools/state if [ "$ACTIVATE" -eq 1 ] ; then echo -n "$STATE, active." diff -u laptop-mode-tools-1.35/debian/changelog laptop-mode-tools-1.35/debian/changelog --- laptop-mode-tools-1.35/debian/changelog +++ laptop-mode-tools-1.35/debian/changelog @@ -1,3 +1,32 @@ +laptop-mode-tools (1.35-1ubuntu1) hardy; urgency=low + + * Merge from debian unstable (LP: #164387), 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. + - /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. + - 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. + - debian/laptop-mode-tools.postinst: Include update-rc.d (LP: #127273) + (Debian generates the .postinst from dh_makeinit) + - debian/laptop-mode-tools.preinst: remove any old acpi scripts + - debian/rules: Don't ship acpi scripts (we handle that ourselves) + - debian/rules: use rm -f to avoid missing-file message + - debian/control: change maintainer + * New Ubuntu-only patch: + - Do not ship apm scripts and remove any old ones + * Dropped Ubuntu-patches now upstream: + - Fix error messages when run as non-root (LP: #77560) + * New upstream changes closing Ubuntu bugs: + - laptop-mode-tools uses hparm -B 255 instead of 254 (LP: #172282) + + -- Tormod Volden Wed, 21 Nov 2007 20:42:58 +0100 + laptop-mode-tools (1.35-1) unstable; urgency=low * New upstream version 1.35. @@ -17,6 +46,36 @@ -- Bart Samwel Sun, 18 Nov 2007 16:33:00 +0200 +laptop-mode-tools (1.34-1ubuntu2) gutsy; urgency=low + + * debian/rules: Don't ship acpi scripts (we handle that ourselves) + (This change got lost in the last merge) + * debian/laptop-mode-tools.preinst: remove any old acpi scripts + * debian/laptop-mode-tools.postinst: Include update-rc.d (LP: #127273) + (Debian generates the .postinst from dh_makeinit) + * debian/rules: use rm -f to avoid missing-file message + + -- Tormod Volden Sat, 21 Jul 2007 00:13:42 +0200 + +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. @@ -51,6 +110,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. @@ -60,6 +125,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. @@ -149,6 +248,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. @@ -206,7 +325,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.35/debian/control laptop-mode-tools-1.35/debian/control --- laptop-mode-tools-1.35/debian/control +++ laptop-mode-tools-1.35/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.7.2 diff -u laptop-mode-tools-1.35/debian/rules laptop-mode-tools-1.35/debian/rules --- laptop-mode-tools-1.35/debian/rules +++ laptop-mode-tools-1.35/debian/rules @@ -28,7 +28,7 @@ clean: dh_testdir dh_testroot - -rm debian/laptop-mode-tools.laptop-mode.init + -rm -f debian/laptop-mode-tools.laptop-mode.init -rm -f build-stamp configure-stamp dh_clean @@ -44,11 +44,11 @@ # Add here commands to install the package into debian/laptop-mode-tools. mkdir -p $(DESTDIR)/etc/laptop-mode - mkdir -p $(DESTDIR)/etc/acpi/events - mkdir -p $(DESTDIR)/etc/acpi/actions +# mkdir -p $(DESTDIR)/etc/acpi/events +# mkdir -p $(DESTDIR)/etc/acpi/actions mkdir -p $(DESTDIR)/usr/sbin mkdir -p $(DESTDIR)/usr/share/laptop-mode-tools/modules - mkdir -p $(DESTDIR)/etc/apm/event.d +# mkdir -p $(DESTDIR)/etc/apm/event.d mkdir -p $(DESTDIR)/etc/power/scripts.d mkdir -p $(DESTDIR)/etc/power/event.d mkdir -p $(DESTDIR)/etc/laptop-mode/batt-start @@ -61,9 +61,9 @@ mkdir -p $(DESTDIR)/etc/laptop-mode/modules install -m600 etc/laptop-mode/laptop-mode.conf $(DESTDIR)/etc/laptop-mode/laptop-mode.conf install -m600 etc/laptop-mode/conf.d/* $(DESTDIR)/etc/laptop-mode/conf.d - install -m700 etc/acpi/actions/* $(DESTDIR)/etc/acpi/actions - install -m600 etc/acpi/events/* $(DESTDIR)/etc/acpi/events - install -m700 etc/apm/event.d/* $(DESTDIR)/etc/apm/event.d +# install -m700 etc/acpi/actions/* $(DESTDIR)/etc/acpi/actions +# install -m600 etc/acpi/events/* $(DESTDIR)/etc/acpi/events +# install -m700 etc/apm/event.d/* $(DESTDIR)/etc/apm/event.d install -m700 etc/power/scripts.d/* $(DESTDIR)/etc/power/scripts.d install -m700 etc/power/event.d/* $(DESTDIR)/etc/power/event.d install -m700 usr/sbin/laptop_mode $(DESTDIR)/usr/sbin only in patch2: unchanged: --- laptop-mode-tools-1.35.orig/debian/laptop-mode-tools.postinst +++ laptop-mode-tools-1.35/debian/laptop-mode-tools.postinst @@ -0,0 +1,20 @@ +#!/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 + +# This would automatically be added by dh_installinit in Debian +if [ -x "/etc/init.d/laptop-mode" ]; then + update-rc.d laptop-mode defaults 99 >/dev/null + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d laptop-mode start || exit $? + else + /etc/init.d/laptop-mode start || exit $? + fi +fi only in patch2: unchanged: --- laptop-mode-tools-1.35.orig/debian/laptop-mode-tools.preinst +++ laptop-mode-tools-1.35/debian/laptop-mode-tools.preinst @@ -0,0 +1,13 @@ +#!/bin/sh -e + +if [ "$1" = "upgrade" -o "$1" = "remove" ]; then + # Remove any previously installed acpi files + rm -f /etc/acpi/events/lm_ac_adapter + rm -f /etc/acpi/events/lm_battery + rm -f /etc/acpi/events/lm_lid + + rm -f /etc/acpi/actions/lm_ac_adapter.sh + rm -f /etc/acpi/actions/lm_battery.sh + rm -f /etc/acpi/actions/lm_lid.sh + rm -f /etc/apm/event.d/laptop-mode +fi