1 |
swift 11/08/17 07:19:29 |
2 |
|
3 |
Modified: power-management-guide.xml |
4 |
Log: |
5 |
Bug #367145 - Update pmg_switch_runlevel.sh script and add a note in the beginning of the document that this script has been updated |
6 |
|
7 |
Revision Changes Path |
8 |
1.48 xml/htdocs/doc/en/power-management-guide.xml |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/power-management-guide.xml?rev=1.48&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/power-management-guide.xml?rev=1.48&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/power-management-guide.xml?r1=1.47&r2=1.48 |
13 |
|
14 |
Index: power-management-guide.xml |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v |
17 |
retrieving revision 1.47 |
18 |
retrieving revision 1.48 |
19 |
diff -u -r1.47 -r1.48 |
20 |
--- power-management-guide.xml 17 Aug 2011 07:10:12 -0000 1.47 |
21 |
+++ power-management-guide.xml 17 Aug 2011 07:19:29 -0000 1.48 |
22 |
@@ -1,6 +1,6 @@ |
23 |
<?xml version='1.0' encoding="UTF-8"?> |
24 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
25 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.47 2011/08/17 07:10:12 swift Exp $ --> |
26 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.48 2011/08/17 07:19:29 swift Exp $ --> |
27 |
|
28 |
<guide> |
29 |
<title>Power Management Guide</title> |
30 |
@@ -24,7 +24,7 @@ |
31 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
32 |
<license/> |
33 |
|
34 |
-<version>3</version> |
35 |
+<version>4</version> |
36 |
<date>2011-08-17</date> |
37 |
|
38 |
<chapter> |
39 |
@@ -32,6 +32,18 @@ |
40 |
<section> |
41 |
<body> |
42 |
|
43 |
+<!-- |
44 |
+ Remove this note after 6 months - ETA 01/02/2012 |
45 |
+ By then, we can assume that OpenRC migrations are not that frequent |
46 |
+ anymore and this note can be dropped. |
47 |
+ ~ Sven Vermeulen |
48 |
+--> |
49 |
+<impo> |
50 |
+Since the introduction of OpenRC, the <c>pmg_switch_runlevel.sh</c> script |
51 |
+needs to be updated. If you have issues after the OpenRC upgrade, please update |
52 |
+this script according to this guide. |
53 |
+</impo> |
54 |
+ |
55 |
<p> |
56 |
Capacity and lifetime of laptop batteries have improved much in the last years. |
57 |
Nevertheless modern processors consume much more energy than older ones and |
58 |
@@ -291,34 +303,42 @@ |
59 |
<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh"> |
60 |
#!/bin/bash |
61 |
|
62 |
-<comment># BEGIN configuration</comment> |
63 |
+# BEGIN configuration |
64 |
RUNLEVEL_AC="default" |
65 |
RUNLEVEL_BATTERY="battery" |
66 |
-<comment># END configuration</comment> |
67 |
+ |
68 |
+if [ -x /usr/bin/logger ]; then |
69 |
+ LOGGER="/usr/bin/logger -s -p daemon.info -t /etc/acpi/actions/pmg_switch_runlevel.sh" |
70 |
+else |
71 |
+ LOGGER="/bin/echo" |
72 |
+fi |
73 |
+ |
74 |
+ON_AC_POWER=/usr/bin/on_ac_power |
75 |
+# END configuration |
76 |
|
77 |
|
78 |
if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] |
79 |
then |
80 |
- logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." |
81 |
+ ${LOGGER} "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." |
82 |
exit 1 |
83 |
fi |
84 |
|
85 |
if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] |
86 |
then |
87 |
- logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." |
88 |
+ ${LOGGER} "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." |
89 |
exit 1 |
90 |
fi |
91 |
|
92 |
-if on_ac_power |
93 |
+if ${on_ac_power} |
94 |
then |
95 |
- if [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] |
96 |
+ if [[ "$(rc-status --runlevel)" != "${RUNLEVEL_AC}" ]] |
97 |
then |
98 |
- logger "Switching to ${RUNLEVEL_AC} runlevel" |
99 |
- /sbin/rc ${RUNLEVEL_AC} |
100 |
+ ${LOGGER} "Switching to ${RUNLEVEL_AC} runlevel" |
101 |
+ /sbin/rc ${RUNLEVEL_AC} |
102 |
fi |
103 |
-elif [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] |
104 |
+elif [[ "$(rc-status --runlevel)" != "${RUNLEVEL_BATTERY}" ]] |
105 |
then |
106 |
- logger "Switching to ${RUNLEVEL_BATTERY} runlevel" |
107 |
+ ${LOGGER} "Switching to ${RUNLEVEL_BATTERY} runlevel" |
108 |
/sbin/rc ${RUNLEVEL_BATTERY} |
109 |
fi |
110 |
</pre> |