--- olpc-powerd-23.orig/debian/olpc-powerd.init
+++ olpc-powerd-23/debian/olpc-powerd.init
@@ -0,0 +1,76 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides: olpc-powerd
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: OLPC XO power management
+### END INIT INFO
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=olpc-powerd
+POWERD_PIDFILE=/var/run/$NAME.pid
+SWITCHD_PIDFILE=/var/run/olpc-switchd.pid
+DESC="OLPC XO power management daemon"
+
+test -x /sbin/powerd || exit 0
+
+. /lib/lsb/init-functions
+
+# allow the admin to set SWITCHD_OPTS
+if [ -f /etc/default/olpc-powerd ]; then
+ . /etc/default/olpc-powerd
+fi
+
+do_start()
+{
+ # switchd is required for lid events; not critical, but nice to have
+ start-stop-daemon --start --quiet --oknodo --background \
+ --make-pidfile --pidfile $SWITCHD_PIDFILE \
+ --exec /sbin/olpc-switchd -- $SWITCHD_OPTS
+
+ # powerd is the daemon we really care about..
+ start-stop-daemon --start --quiet --oknodo --background \
+ --make-pidfile --pidfile $POWERD_PIDFILE \
+ --exec /sbin/powerd
+}
+
+do_stop()
+{
+ start-stop-daemon --stop --quiet --oknodo --pidfile $POWERD_PIDFILE \
+ --name powerd
+ start-stop-daemon --stop --quiet --oknodo --pidfile $SWITCHD_PIDFILE \
+ --name olpc-switchd
+}
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ log_end_msg $?
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ log_end_msg $?
+ ;;
+
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ sleep 1
+ do_start
+ log_end_msg $?
+ ;;
+
+ *)
+ log_success_msg "Usage: $0 {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
--- olpc-powerd-23.orig/debian/compat
+++ olpc-powerd-23/debian/compat
@@ -0,0 +1 @@
+7
--- olpc-powerd-23.orig/debian/configdir.patch
+++ olpc-powerd-23/debian/configdir.patch
@@ -0,0 +1,22 @@
+--- a/powerd 2010-06-16 20:31:20.000000000 +0000
++++ b/powerd 2010-06-16 20:31:57.000000000 +0000
+@@ -370,7 +370,7 @@
+ #
+
+ XO=;
+-CONFIGDIR=/etc/powerd
++CONFIGDIR=/etc/olpc-powerd
+
+ VERSIONFILE=$CONFIGDIR/version
+ CONFIGFILE=$CONFIGDIR/powerd.conf
+--- a/powerd-config 2010-06-16 20:32:19.000000000 +0000
++++ b/powerd-config 2010-06-16 20:32:27.000000000 +0000
+@@ -28,7 +28,7 @@
+
+ INHIBITDIR=/var/run/powerd-inhibit-suspend
+ INHIBIT_BY_TOUCH=$INHIBITDIR/.fake_activity
+-CONFIGDIR=/etc/powerd
++CONFIGDIR=/etc/olpc-powerd
+ CONFIGFILE=$CONFIGDIR/powerd.conf
+ TMPCONFIG=$CONFIGFILE.tmp
+ NEWCONFIG=$TMPCONFIG.new
--- olpc-powerd-23.orig/debian/olpc-powerd.install
+++ olpc-powerd-23/debian/olpc-powerd.install
@@ -0,0 +1,9 @@
+olpc-switchd /sbin
+powerd /sbin
+pnmto565fb /usr/bin
+powerd-config /usr/bin
+olpc-nosleep /usr/bin
+pleaseconfirm.pgm /usr/share/olpc-powerd
+shuttingdown.pgm /usr/share/olpc-powerd
+debian/powerd.conf /etc/olpc-powerd
+version /etc/olpc-powerd
--- olpc-powerd-23.orig/debian/changelog
+++ olpc-powerd-23/debian/changelog
@@ -0,0 +1,26 @@
+olpc-powerd (23-2) unstable; urgency=low
+
+ * Add a missing dependency on ethtool (thanks, Sascha Silbe!).
+
+ -- Andres Salomon <dilinger@debian.org> Fri, 18 Jun 2010 15:44:50 +0000
+
+olpc-powerd (23-1) unstable; urgency=low
+
+ * New upstream release.
+ * Fix CONFIGDIR variable in scripts (closes: #585141).
+
+ -- Andres Salomon <dilinger@debian.org> Wed, 16 Jun 2010 20:23:25 +0000
+
+olpc-powerd (22-1) unstable; urgency=low
+
+ * New upstream release.
+ * Fixes a bashism in an upstream script (closes: #581131).
+
+ -- Andres Salomon <dilinger@debian.org> Tue, 01 Jun 2010 21:41:59 +0000
+
+olpc-powerd (19-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- Andres Salomon <dilinger@debian.org> Sat, 17 Apr 2010 20:04:33 +0000
+
--- olpc-powerd-23.orig/debian/powerd.conf
+++ olpc-powerd-23/debian/powerd.conf
@@ -0,0 +1,101 @@
+#
+# Config file for powerd
+#
+# config_BATTERY_TIME_{DIM,SLEEP,BLANK}
+# config_EBOOK_TIME_{DIM,SLEEP,BLANK}
+# config_PLUGGED_TIME_{DIM,SLEEP,BLANK}
+# These are the time in seconds (measured from last user
+# activity) until a) the laptop screen dims, b) the laptop
+# sleeps, and c) the laptop screen blanks. All three can be
+# scheduled in any order. Setting any to '0' suppresses that
+# action.
+#
+# config_MAX_SLEEP_BEFORE_SHUTDOWN
+# Once the laptop sleeps and the screen is blank, it will shut
+# down after this amount of time. '0' will prevent auto-shutdown.
+#
+# config_ALLOW_SHUTDOWN_WHEN_PLUGGED
+# If this is disabled, the laptop will never automatically shut
+# down when using external power. (It may still sleep, however.)
+#
+# config_IDLE_DIM_LEVEL
+# Brightness level when the screen is automatically dimmed. Set
+# this to 15 to prevent dimming. Set this to 0 to allow the
+# backlight to go off completely.
+#
+# config_CONFIRM_SECONDS
+# How long the shutdown/suspend confirmation splash screen stays
+# visible before the laptop automatically suspends. If this is
+# zero, there will be no splash screen: the laptop will suspend
+# immediately when the button is pushed.
+#
+# config_UNFREEZE_SECONDS
+# How long after starting will powerd wait before gratuitously
+# unfreezing the DCON, to activate the display. This allows most
+# of the intermediate stages of boot screens to be hidden until
+# the window manager is ready.
+#
+# config_MESH_DURING_SUSPEND (only on XO-1)
+# This controls whether the wireless remains powered while the
+# laptop is fully suspended (i.e., sleeping with a dark screen).
+# The only reason to set this to "yes" is if you want the laptop
+# to forward packets for other mesh users while you're not using it.
+#
+# config_WAKE_ON_WLAN
+# Controls whether a packet destined for your laptop will wake it
+# up from idle suspend, in much the same way that a keystroke or
+# mouse movement will wake it up. Also see the following option:
+#
+# config_WLAN_WAKE_FROM_BLANK_IDLE_SLEEP
+# Controls whether the config_WAKE_ON_WLAN setting (above) also
+# applies once the screen has blanked. Laptops which are
+# regularly accessed remotely should probably set this to "yes",
+# otherwise it saves power to leave it set to "no".
+#
+# config_KEYPRESS_WAKE_FROM_BLANK_IDLE_SLEEP
+# If the screen is blank and the laptop has suspended due to the
+# user being idle, then setting this to "yes" will let user
+# activity wake the laptop. Otherwise, being suspended with a
+# blank screen (which is visually the same as a power
+# button-induced sleep) will require the power button to wake.
+# If you like having the keyboard completely disabled during any
+# "dark" sleep, then set this to "no".
+#
+#
+# config_CPU_IDLE_LIMIT
+# If the cpu is idle less than this percentage, then the laptop
+# won't suspend.
+#
+# config_SLEEP_WHEN_LID_CLOSED
+# This is normally left enabled, and causes the laptop to go to sleep
+# when closed. If disabled, it will stay awake when the lid is
+# closed, and will only sleep because of other timeouts.
+#
+# config_PWRLOG_INTERVAL
+# config_PWRLOG_DIR
+# config_PWRLOG_LOGSIZE
+# config_PWRLOG_LOGDIRSIZE
+# Refer to the notes in the powerd script itself for descriptions
+# of how these control powerd's optional power logging.
+#
+config_CPU_IDLE_LIMIT="85"
+config_BATTERY_TIME_DIM="180"
+config_BATTERY_TIME_SLEEP="15"
+config_BATTERY_TIME_BLANK="420"
+config_EBOOK_TIME_DIM="180"
+config_EBOOK_TIME_SLEEP="15"
+config_EBOOK_TIME_BLANK="420"
+config_PLUGGED_TIME_DIM="180"
+config_PLUGGED_TIME_SLEEP="15"
+config_PLUGGED_TIME_BLANK="420"
+config_IDLE_DIM_LEVEL="5"
+config_MESH_DURING_SUSPEND="no"
+config_WAKE_ON_WLAN="yes"
+config_WLAN_WAKE_FROM_BLANK_IDLE_SLEEP="no"
+config_KEYPRESS_WAKE_FROM_BLANK_IDLE_SLEEP="yes"
+config_MAX_SLEEP_BEFORE_SHUTDOWN="14400"
+config_ALLOW_SHUTDOWN_WHEN_PLUGGED="no"
+config_SLEEP_WHEN_LID_CLOSED="yes"
+config_CONFIRM_SECONDS="7"
+config_UNFREEZE_SECONDS="12"
+config_PWRLOG_INTERVAL="0"
--- olpc-powerd-23.orig/debian/olpc-powerd.default
+++ olpc-powerd-23/debian/olpc-powerd.default
@@ -0,0 +1,3 @@
+# poll for power events every 10 seconds
+# report periodic timer at least every 60
+SWITCHD_OPTS="-f -l -p 10 -t 6 -F /var/run/powerevents"
--- olpc-powerd-23.orig/debian/rules
+++ olpc-powerd-23/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
+debian/powerd.conf:
+ cp powerd.conf.dist debian/powerd.conf
+ # we don't use pwrlog stuff
+ sed -i s/^config_PWRLOG_INTERVAL=.*/config_PWRLOG_INTERVAL=\"0\"/g debian/powerd.conf
--- olpc-powerd-23.orig/debian/olpc-powerd.docs
+++ olpc-powerd-23/debian/olpc-powerd.docs
@@ -0,0 +1 @@
+todo
--- olpc-powerd-23.orig/debian/olpc-powerd.dirs
+++ olpc-powerd-23/debian/olpc-powerd.dirs
@@ -0,0 +1,4 @@
+/usr/bin
+/usr/sbin
+/etc/olpc-powerd
+/usr/share/olpc-powerd
--- olpc-powerd-23.orig/debian/copyright
+++ olpc-powerd-23/debian/copyright
@@ -0,0 +1,31 @@
+This package was debianized by Andres Salomon <dilinger@debian.org> on
+Sat, 17 Apr 2010 00:02:54 +0000
+
+It was downloaded from: <http://dev.laptop.org/~pgf/rpms/srpms/>.
+
+Upstream Authors:
+ Paul Fox <pgf@laptop.org>
+
+Copyright (C) 1996 Geert Uytterhoeven
+Copyright (C) 1996-2000 Chris Lawrence
+Copyright (C) 2008,2009,2010 One Laptop per Child
+Copyright (C) 2009,2010 Paul G. Fox
+
+License:
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this package; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in `/usr/share/common-licenses/GPL'.
--- olpc-powerd-23.orig/debian/control
+++ olpc-powerd-23/debian/control
@@ -0,0 +1,18 @@
+Source: olpc-powerd
+Section: admin
+Priority: optional
+Maintainer: Andres Salomon <dilinger@debian.org>
+Build-Depends: debhelper (>> 7)
+Standards-Version: 3.8.4
+
+Package: olpc-powerd
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ethtool
+Recommends: iptables
+Description: OLPC XO power management support daemon
+ The powerd daemon can function as an easily customizable replacement for ohmd
+ (independent of X, dbus, and hald). This package provides the powerd
+ and olpc-switchd daemons, and related utilities. The olpc-switchd daemon
+ simply provides notifications about lid and switch events. The powerd daemon
+ controls display dimming, automatically putting an XO to sleep after a period
+ of idleness, etc.