/[gentoo]/xml/htdocs/doc/en/power-management-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/power-management-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.47 Revision 1.48
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.47 2011/08/17 07:10:12 swift Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.48 2011/08/17 07:19:29 swift Exp $ -->
4 4
5<guide> 5<guide>
6<title>Power Management Guide</title> 6<title>Power Management Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
22 22
23<!-- The content of this document is licensed under the CC-BY-SA license --> 23<!-- The content of this document is licensed under the CC-BY-SA license -->
24<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 24<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
25<license/> 25<license/>
26 26
27<version>3</version> 27<version>4</version>
28<date>2011-08-17</date> 28<date>2011-08-17</date>
29 29
30<chapter> 30<chapter>
31<title>Introduction</title> 31<title>Introduction</title>
32<section> 32<section>
33<body> 33<body>
34
35<!--
36 Remove this note after 6 months - ETA 01/02/2012
37 By then, we can assume that OpenRC migrations are not that frequent
38 anymore and this note can be dropped.
39 ~ Sven Vermeulen
40-->
41<impo>
42Since the introduction of OpenRC, the <c>pmg_switch_runlevel.sh</c> script
43needs to be updated. If you have issues after the OpenRC upgrade, please update
44this script according to this guide.
45</impo>
34 46
35<p> 47<p>
36Capacity and lifetime of laptop batteries have improved much in the last years. 48Capacity and lifetime of laptop batteries have improved much in the last years.
37Nevertheless modern processors consume much more energy than older ones and 49Nevertheless modern processors consume much more energy than older ones and
38each laptop generation introduces more devices hungry for energy. That's why 50each laptop generation introduces more devices hungry for energy. That's why
289</p> 301</p>
290 302
291<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh"> 303<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
292#!/bin/bash 304#!/bin/bash
293 305
294<comment># BEGIN configuration</comment> 306# BEGIN configuration
295RUNLEVEL_AC="default" 307RUNLEVEL_AC="default"
296RUNLEVEL_BATTERY="battery" 308RUNLEVEL_BATTERY="battery"
297<comment># END configuration</comment> 309
310if [ -x /usr/bin/logger ]; then
311 LOGGER="/usr/bin/logger -s -p daemon.info -t /etc/acpi/actions/pmg_switch_runlevel.sh"
312else
313 LOGGER="/bin/echo"
314fi
315
316ON_AC_POWER=/usr/bin/on_ac_power
317# END configuration
298 318
299 319
300if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] 320if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]
301then 321then
302 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." 322 ${LOGGER} "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."
303 exit 1 323 exit 1
304fi 324fi
305 325
306if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] 326if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]
307then 327then
308 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." 328 ${LOGGER} "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."
309 exit 1 329 exit 1
310fi 330fi
311 331
312if on_ac_power 332if ${on_ac_power}
313then 333then
314 if [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] 334 if [[ "$(rc-status --runlevel)" != "${RUNLEVEL_AC}" ]]
315 then 335 then
316 logger "Switching to ${RUNLEVEL_AC} runlevel" 336 ${LOGGER} "Switching to ${RUNLEVEL_AC} runlevel"
317 /sbin/rc ${RUNLEVEL_AC} 337 /sbin/rc ${RUNLEVEL_AC}
318 fi 338 fi
319elif [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] 339elif [[ "$(rc-status --runlevel)" != "${RUNLEVEL_BATTERY}" ]]
320then 340then
321 logger "Switching to ${RUNLEVEL_BATTERY} runlevel" 341 ${LOGGER} "Switching to ${RUNLEVEL_BATTERY} runlevel"
322 /sbin/rc ${RUNLEVEL_BATTERY} 342 /sbin/rc ${RUNLEVEL_BATTERY}
323fi 343fi
324</pre> 344</pre>
325 345
326<p> 346<p>

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.20