Merge lp://staging/~mterry/acpi-support/use-pm-powersave into lp://staging/acpi-support

Proposed by Michael Terry
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~mterry/acpi-support/use-pm-powersave
Merge into: lp://staging/acpi-support
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~mterry/acpi-support/use-pm-powersave
Reviewer Review Type Date Requested Status
Steve Langasek Pending
Review via email: mp+7945@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Here's a branch to remove ac.d and battery.d. See bug 385949 for context and discussion.

I also threw in conversion of debian/copyright to DEP5 as a bonus.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory 'ac.d'
2=== removed file 'ac.d/90-hdparm.sh'
3--- ac.d/90-hdparm.sh 2009-01-15 14:22:16 +0000
4+++ ac.d/90-hdparm.sh 1970-01-01 00:00:00 +0000
5@@ -1,41 +0,0 @@
6-#! /bin/sh
7-#
8-# This script adjusts hard drive APM settings using hdparm. The hardware
9-# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
10-# on many modern hard drives. We therefore set hdparm -B 254 while on AC
11-# power. On battery we set hdparm -B 128, because the head parking is
12-# very useful for shock protection.
13-#
14-
15-. /usr/share/acpi-support/power-funcs
16-
17-DO_HDPARM=y
18-if [ -e /usr/sbin/laptop_mode ] ; then
19- LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
20- if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
21- && [ -e /var/run/laptop-mode-tools/enabled ]
22- then
23- # Laptop mode controls hdparm -B settings, we don't.
24- DO_HDPARM=n
25- fi
26-fi
27-
28-if [ "$DO_HDPARM" = y ] ; then
29- # Get the power state into STATE
30- getState;
31-
32- for dev in /dev/sd? /dev/hd? ; do
33- if [ -b $dev ] ; then
34- # Check for APM support; discard errors since not all drives
35- # support HDIO_GET_IDENTITY (-i).
36- if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
37- if [ "$STATE" = "BATTERY" ] ; then
38- hdparm -B 128 $dev
39- else
40- hdparm -B 254 $dev
41- fi
42- fi
43- fi
44- done
45-fi
46-
47
48=== removed directory 'battery.d'
49=== removed file 'battery.d/90-hdparm.sh'
50--- battery.d/90-hdparm.sh 2009-01-15 14:22:16 +0000
51+++ battery.d/90-hdparm.sh 1970-01-01 00:00:00 +0000
52@@ -1,41 +0,0 @@
53-#! /bin/sh
54-#
55-# This script adjusts hard drive APM settings using hdparm. The hardware
56-# defaults (usually hdparm -B 128) cause excessive head load/unload cycles
57-# on many modern hard drives. We therefore set hdparm -B 254 while on AC
58-# power. On battery we set hdparm -B 128, because the head parking is
59-# very useful for shock protection.
60-#
61-
62-. /usr/share/acpi-support/power-funcs
63-
64-DO_HDPARM=y
65-if [ -e /usr/sbin/laptop_mode ] ; then
66- LMT_CONTROL_HD_POWERMGMT=$(. /etc/laptop-mode/laptop-mode.conf && echo "$CONTROL_HD_POWERMGMT")
67- if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
68- && [ -e /var/run/laptop-mode-tools/enabled ]
69- then
70- # Laptop mode controls hdparm -B settings, we don't.
71- DO_HDPARM=n
72- fi
73-fi
74-
75-if [ "$DO_HDPARM" = y ] ; then
76- # Get the power state into STATE
77- getState;
78-
79- for dev in /dev/sd? /dev/hd? ; do
80- if [ -b $dev ] ; then
81- # Check for APM support; discard errors since not all drives
82- # support HDIO_GET_IDENTITY (-i).
83- if hdparm -i $dev 2> /dev/null | grep -q 'AdvancedPM=yes' ; then
84- if [ "$STATE" = "BATTERY" ] ; then
85- hdparm -B 128 $dev
86- else
87- hdparm -B 254 $dev
88- fi
89- fi
90- fi
91- done
92-fi
93-
94
95=== modified file 'debian/changelog'
96--- debian/changelog 2009-05-18 02:08:56 +0000
97+++ debian/changelog 2009-06-11 19:06:23 +0000
98@@ -1,9 +1,19 @@
99-acpi-support (0.123) UNRELEASED; urgency=low
100+acpi-support (0.124) karmic; urgency=low
101+
102+ * debian/copyright: Convert to DEP5 format
103+ * ac.d, battery.d, power.sh, debian/init.d, debian/rules:
104+ - Don't install power hook directories, instead just call pm-powersave
105+ * debian/preinst:
106+ - Remove ac.d and battery.d conffiles
107+
108+ -- Michael Terry <michael.terry@canonical.com> Thu, 11 Jun 2009 14:29:34 -0400
109+
110+acpi-support (0.123) karmic; urgency=low
111
112 * events/asus-volume-{up,down,mute}: drop, these are handled in the kernel
113 input layer now. LP: #286339.
114
115- -- Steve Langasek <steve.langasek@ubuntu.com> Sun, 17 May 2009 19:04:42 -0700
116+ -- Steve Langasek <steve.langasek@ubuntu.com> Sun, 17 May 2009 19:10:16 -0700
117
118 acpi-support (0.122) karmic; urgency=low
119
120
121=== modified file 'debian/copyright'
122--- debian/copyright 2009-01-15 01:03:10 +0000
123+++ debian/copyright 2009-06-11 13:06:26 +0000
124@@ -1,23 +1,12 @@
125-This package written and debianised for Ubuntu by Thom May
126-<thom@canonical.com> based on work by Matthew Garrett
127-<mjg59@srcf.ucam.org>.
128-
129-Copyright (C) 2004 Canonical Ltd.
130- Authors: Matthew Garrett, Thom May
131-
132-acpi-support is licensed under the GNU general public license, version 2
133-
134-acpi-support is free software; you can redistribute it and/or modify it under
135-the terms of the GNU General Public License as published by the Free Software
136-Foundation; either version 2, or (at your option) any later version.
137-
138-acpi-support is distributed in the hope that it will be useful, but WITHOUT ANY
139-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
140-PARTICULAR PURPOSE. See the GNU General Public License for more details.
141-
142-You should have received a copy of the GNU General Public License along with
143-acpi-support; see the file COPYING. If not, write to the Free Software
144-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
145-
146-On Debian systems, a copy of the GNU General Public License is available in
147-/usr/share/common-licenses/GPL as part of the base-files package.
148+Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=54
149+Name: acpi-support
150+Contact: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
151+Source: https://code.launchpad.net/~ubuntu-core-dev/acpi-support/trunk/
152+
153+Files: *
154+Copyright: 2004-2009, Matthew Garrett <mjg59@srcf.ucam.org>
155+ 2004-2009, Thom May <thom@canonical.com>
156+ 2004-2009, Canonical Ltd.
157+License: GPL-2+
158+ On Debian systems the full text of the GNU General Public License
159+ can be found in the '/usr/share/common-licenses/GPL-2' file.
160
161=== modified file 'debian/init.d'
162--- debian/init.d 2009-01-15 01:02:38 +0000
163+++ debian/init.d 2009-06-11 19:06:23 +0000
164@@ -25,7 +25,7 @@
165 ;;
166 stop)
167 log_begin_msg "Disabling power management..."
168- /etc/acpi/power.sh stop
169+ /etc/acpi/power.sh false
170 log_end_msg 0
171 ;;
172 *)
173
174=== modified file 'debian/preinst'
175--- debian/preinst 2009-05-18 02:08:56 +0000
176+++ debian/preinst 2009-06-11 19:06:23 +0000
177@@ -18,6 +18,12 @@
178 fi
179 }
180
181+rm_confdir() {
182+ DIRNAME="$1"
183+ if [ -d "$DIRNAME" ]; then
184+ rmdir --ignore-fail-on-non-empty "$DIRNAME"
185+ fi
186+}
187
188 case "$1" in
189 install|upgrade)
190@@ -98,12 +104,8 @@
191 rm_conffile acpi-support /etc/acpi/suspend.d/75-console-switch.sh
192 rm_conffile acpi-support /etc/acpi/suspend.d/85-alsa-state.sh
193 rm_conffile acpi-support /etc/acpi/suspend.d/90-framebuffer-stop.sh
194- if [ -d /etc/acpi/resume.d ]; then
195- rmdir --ignore-fail-on-non-empty /etc/acpi/resume.d
196- fi
197- if [ -d /etc/acpi/suspend.d ]; then
198- rmdir --ignore-fail-on-non-empty /etc/acpi/suspend.d
199- fi
200+ rm_confdir /etc/acpi/resume.d
201+ rm_confdir /etc/acpi/suspend.d
202 rm_conffile acpi-support /etc/acpi/prepare.sh
203 rm_conffile acpi-support /etc/acpi/resume.sh
204 fi
205@@ -112,6 +114,12 @@
206 rm_conffile acpi-support /etc/acpi/events/asus-volume-up
207 rm_conffile acpi-support /etc/acpi/events/asus-volume-mute
208 fi
209+ if dpkg --compare-versions "$2" lt-nl "0.124"; then
210+ rm_conffile acpi-support /etc/acpi/ac.d/90-hdparm.sh
211+ rm_conffile acpi-support /etc/acpi/battery.d/90-hdparm.sh
212+ rm_confdir /etc/acpi/ac.d
213+ rm_confdir /etc/acpi/battery.d
214+ fi
215 esac
216
217
218
219=== modified file 'debian/rules'
220--- debian/rules 2009-04-27 13:54:21 +0000
221+++ debian/rules 2009-06-11 19:06:23 +0000
222@@ -30,12 +30,6 @@
223 for file in start.d/*.sh; do\
224 install -m 755 $$file debian/acpi-support/etc/acpi/start.d/;\
225 done
226- for file in battery.d/*.sh; do\
227- install -m 755 $$file debian/acpi-support/etc/acpi/battery.d/;\
228- done
229- for file in ac.d/*.sh; do\
230- install -m 755 $$file debian/acpi-support/etc/acpi/ac.d/;\
231- done
232 for file in *.sh; do\
233 install -m 755 $$file debian/acpi-support/etc/acpi/;\
234 done
235
236=== modified file 'power.sh'
237--- power.sh 2009-01-15 01:03:10 +0000
238+++ power.sh 2009-06-26 14:16:22 +0000
239@@ -1,27 +1,11 @@
240-#!/bin/bash
241-# TODO: Change above to /bin/sh
242+#!/bin/sh
243
244 test -f /usr/share/acpi-support/key-constants || exit 0
245
246-. /etc/default/acpi-support
247-. /usr/share/acpi-support/power-funcs
248-
249-getState;
250-
251-checkStateChanged;
252-
253-shopt -s nullglob
254-
255-for x in /proc/acpi/ac_adapter/*; do
256- grep -q off-line $x/state
257-
258- if [ $? = 0 ] && [ x$1 != xstop ]; then
259- for SCRIPT in /etc/acpi/battery.d/*.sh; do
260- . $SCRIPT
261- done
262- else
263- for SCRIPT in /etc/acpi/ac.d/*.sh; do
264- . $SCRIPT
265- done
266- fi
267-done
268+. /usr/share/acpi-support/policy-funcs
269+
270+if [ -z "$*" ] && [ `CheckPolicy` = 0 ]; then
271+ exit;
272+fi
273+
274+pm-powersave $*

Subscribers

People subscribed via source and target branches