From 2ca74b400de2bfe1f6330a9ea733901c91ea63e0 Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Thu, 11 Nov 2010 02:29:32 +0000
Subject: acpid: update to 1.0.10

---
 abs/core/acpid/PKGBUILD         | 25 +++++++++------
 abs/core/acpid/__changelog      |  2 +-
 abs/core/acpid/acpid            |  4 ++-
 abs/core/acpid/acpid.conf.d     |  6 ++++
 abs/core/acpid/handler.sh.runit | 68 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+), 11 deletions(-)
 create mode 100644 abs/core/acpid/acpid.conf.d
 create mode 100644 abs/core/acpid/handler.sh.runit

diff --git a/abs/core/acpid/PKGBUILD b/abs/core/acpid/PKGBUILD
index 5b9d033..911f04b 100644
--- a/abs/core/acpid/PKGBUILD
+++ b/abs/core/acpid/PKGBUILD
@@ -1,21 +1,22 @@
-# $Id: PKGBUILD 20369 2008-12-03 02:03:14Z thayer $
+# $Id: PKGBUILD 65397 2010-01-28 19:48:01Z thayer $
+# Maintainer: Thayer Williams <thayer@archlinux.org>
 # Contributor: Manolis Tzanidakis
 # Contributor: Judd Vinet <jvinet@zeroflux.org>
-# Maintainer: Thayer Williams <thayer@archlinux.org>
 
 pkgname=acpid
-pkgver=1.0.8
-pkgrel=2
+pkgver=1.0.10
+pkgrel=3
 pkgdesc="A daemon for delivering ACPI power management events"
-url="http://acpid.sourceforge.net"
-license=('GPL2')
 arch=('i686' 'x86_64')
+url="http://acpid.sourceforge.net"
+license=('GPL')
 depends=(glibc)
 source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz
     acpid
+    acpid.conf.d
     anything
-    handler.sh)
-backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything')
+    handler.sh.runit)
+backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything' 'etc/conf.d/acpid')
 
 build() {
     cd $srcdir/$pkgname-$pkgver
@@ -26,9 +27,15 @@ build() {
 
     # install our supplementary scripts
     /bin/install -D -m0755 $srcdir/acpid $pkgdir/etc/rc.d/acpid || return 1
+    /bin/install -D -m0644 $srcdir/acpid.conf.d $pkgdir/etc/conf.d/acpid || return 1
     /bin/install -D -m0644 $srcdir/anything $pkgdir/etc/acpi/events/anything || return 1
-    /bin/install -D -m0755 $srcdir/handler.sh $pkgdir/etc/acpi/handler.sh || return 1
+    /bin/install -D -m0755 $srcdir/handler.sh.runit $pkgdir/etc/acpi/handler.sh || return 1
 
     # set world readable bit on the acpid binary
     /bin/chmod 755 $pkgdir/usr/sbin/acpid || return 1
 }
+md5sums=('61156ef32015c56dc0f2e3317f4ae09e'
+         'd9ca7f71f520238a0448fab105a23fe9'
+         '91fdb3709c878eed757d192a420251a1'
+         '2d37b98d6e74bab815604b8b48c6cfd4'
+         'e2c6fccd6ba099045b358fb1128a4905')
diff --git a/abs/core/acpid/__changelog b/abs/core/acpid/__changelog
index 1de4ec0..9802b2b 100644
--- a/abs/core/acpid/__changelog
+++ b/abs/core/acpid/__changelog
@@ -1,2 +1,2 @@
 Modify handler.sh to use runit-init. 
-
+update to 1.0.10 and change handler.sh to handler.sh.runit
diff --git a/abs/core/acpid/acpid b/abs/core/acpid/acpid
index 585944f..9a4ab8a 100644
--- a/abs/core/acpid/acpid
+++ b/abs/core/acpid/acpid
@@ -3,11 +3,13 @@
 . /etc/rc.conf
 . /etc/rc.d/functions
 
+[ -f /etc/conf.d/acpid ] && . /etc/conf.d/acpid
+
 PID=`pidof -o %PPID /usr/sbin/acpid`
 case "$1" in
   start)
     stat_busy "Starting acpid"
-    [ -z "$PID" ] && /usr/sbin/acpid
+    [ -z "$PID" ] && /usr/sbin/acpid $ACPID_ARGS
     if [ $? -gt 0 ]; then
       stat_fail
     else
diff --git a/abs/core/acpid/acpid.conf.d b/abs/core/acpid/acpid.conf.d
new file mode 100644
index 0000000..25c9cc1
--- /dev/null
+++ b/abs/core/acpid/acpid.conf.d
@@ -0,0 +1,6 @@
+#
+# Arguments to be passed to the acpid daemon
+#
+
+ACPID_ARGS=""
+
diff --git a/abs/core/acpid/handler.sh.runit b/abs/core/acpid/handler.sh.runit
new file mode 100644
index 0000000..9fb2593
--- /dev/null
+++ b/abs/core/acpid/handler.sh.runit
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
+#       modify it to not use /sys
+
+minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
+
+set $*
+
+case "$1" in
+    button/power)
+        #echo "PowerButton pressed!">/dev/tty5
+        case "$2" in
+            PWRF)   logger "PowerButton pressed: $2"
+                    /sbin/runit-init 0
+                    /sbin/poweroff
+                    ;;
+            *)      logger "ACPI action undefined: $2" ;;
+        esac
+        ;;
+    button/sleep)
+        case "$2" in
+            SLPB)   echo -n mem >/sys/power/state ;;
+            *)      logger "ACPI action undefined: $2" ;;
+        esac
+        ;;
+    ac_adapter)
+        case "$2" in
+            AC)
+                case "$4" in
+                    00000000)
+                        echo -n $minspeed >$setspeed
+                        #/etc/laptop-mode/laptop-mode start
+                    ;;
+                    00000001)
+                        echo -n $maxspeed >$setspeed
+                        #/etc/laptop-mode/laptop-mode stop
+                    ;;
+                esac
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
+        esac
+        ;;
+    battery)
+        case "$2" in
+            BAT0)
+                case "$4" in
+                    00000000)   #echo "offline" >/dev/tty5
+                    ;;
+                    00000001)   #echo "online"  >/dev/tty5
+                    ;;
+                esac
+                ;;
+            CPU0)	
+                ;;
+            *)  logger "ACPI action undefined: $2" ;;
+        esac
+        ;;
+    button/lid)
+        #echo "LID switched!">/dev/tty5
+        ;;
+    *)
+        logger "ACPI group/action undefined: $1 / $2"
+        ;;
+esac
-- 
cgit v0.12