Attached is the patch that Ubuntu currently uses to address the power 
management issue.

I propose to NMU this unless the maintainer beats me to it.
diff -u anacron-2.3/debian/dirs anacron-2.3/debian/dirs
--- anacron-2.3/debian/dirs
+++ anacron-2.3/debian/dirs
@@ -4,6 +4,8 @@
 etc/cron.weekly
 etc/cron.monthly
 etc/apm/event.d
+usr/lib/pm-utils/power.d/
+usr/lib/pm-utils/sleep.d/
 usr/sbin
 usr/share/doc/anacron
 usr/share/man/man5
diff -u anacron-2.3/debian/rules anacron-2.3/debian/rules
--- anacron-2.3/debian/rules
+++ anacron-2.3/debian/rules
@@ -36,6 +36,8 @@
 	install debian/0anacron.weekly debian/anacron/etc/cron.weekly/0anacron
 	install debian/0anacron.monthly debian/anacron/etc/cron.monthly/0anacron
 	install -m 755 debian/apm.d debian/anacron/etc/apm/event.d/anacron
+	install -m 755 debian/pm-utils.power.d debian/anacron/usr/lib/pm-utils/power.d/anacron
+	install -m 755 debian/pm-utils.sleep.d debian/anacron/usr/lib/pm-utils/sleep.d/95anacron
 
 	touch install-stamp
 
diff -u anacron-2.3/debian/changelog anacron-2.3/debian/changelog
--- anacron-2.3/debian/changelog
+++ anacron-2.3/debian/changelog
@@ -1,3 +1,11 @@
+anacron (2.3-13.2) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Install pm-utils hook that starts/stops anacron on suspend/resume; merged
+    from Ubuntu (Closes: #202605)
+
+ -- Peter Eisentraut <pet...@debian.org>  Sun, 21 Jun 2009 10:02:52 +0300
+
 anacron (2.3-13.1) unstable; urgency=low
 
   * Non-maintainer upload to fix release goal issue.
only in patch2:
unchanged:
--- anacron-2.3.orig/debian/pm-utils.power.d
+++ anacron-2.3/debian/pm-utils.power.d
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# This script makes anacron jobs start/stop when a machine gets or loses AC
+# power.
+
+# The /etc/init.d/anacron script now normally tries to avoid running anacron
+# unless on AC power, so as to avoid running down the battery.  (Things like
+# the slocate updatedb cause a lot of I/O.)  Rather than trying to
+# second-guess which events reflect having or not having power, we just try to
+# run anacron every time and let it abort if there's no AC.  You'll see a
+# message on the cron syslog facility (typically /var/log/cron) if it does
+# run.
+
+case $1 in
+    false)
+	/usr/sbin/invoke-rc.d anacron start >/dev/null   
+	;;
+    true)
+	/usr/sbin/invoke-rc.d anacron stop >/dev/null   
+	;;
+esac
only in patch2:
unchanged:
--- anacron-2.3.orig/debian/pm-utils.sleep.d
+++ anacron-2.3/debian/pm-utils.sleep.d
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# This script makes anacron jobs start to run when the machine is woken up.
+# For a laptop, these are the closest parallels to turning on a desktop.
+
+# The /etc/init.d/anacron script now normally tries to avoid running anacron
+# unless on AC power, so as to avoid running down the battery.  (Things like
+# the slocate updatedb cause a lot of I/O.)  Rather than trying to
+# second-guess which events reflect having or not having power, we just try to
+# run anacron every time and let it abort if there's no AC.  You'll see a
+# message on the cron syslog facility (typically /var/log/cron) if it does
+# run.
+
+case $1 in
+    resume|thaw)
+	/usr/sbin/invoke-rc.d anacron start >/dev/null   
+	;;
+    suspend|hibernate)
+	/usr/sbin/invoke-rc.d anacron stop >/dev/null   
+	;;
+esac

Reply via email to