summaryrefslogtreecommitdiff
path: root/community/acpid
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
committerroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
commit7a65a910b77ad191d69881098c47f9b0c852d92e (patch)
tree9564e611af1442f8952a8cbddb3b0ad25ed71aab /community/acpid
parent60da6abff6c9577a783d72865f11de7a585e912e (diff)
Tue Aug 13 01:31:08 PDT 2013
Diffstat (limited to 'community/acpid')
-rw-r--r--community/acpid/PKGBUILD52
-rw-r--r--community/acpid/acpid.service10
-rw-r--r--community/acpid/acpid.socket8
-rw-r--r--community/acpid/anything3
-rw-r--r--community/acpid/handler.sh77
5 files changed, 150 insertions, 0 deletions
diff --git a/community/acpid/PKGBUILD b/community/acpid/PKGBUILD
new file mode 100644
index 000000000..0b3ff7969
--- /dev/null
+++ b/community/acpid/PKGBUILD
@@ -0,0 +1,52 @@
+# $Id: PKGBUILD 91937 2013-05-29 23:05:51Z seblu $
+# Maintainer: Sébastien Luttringer
+# Contributor: xduugu
+# Contributor: Manolis Tzanidakis
+# Contributor: Jonathan Schmidt <j.schmidt@archlinux.us
+
+pkgname=acpid
+pkgver=2.0.19
+pkgrel=1
+pkgdesc='A daemon for delivering ACPI power management events with netlink support'
+arch=('i686' 'x86_64')
+url='http://sourceforge.net/projects/acpid2/'
+license=('GPL')
+depends=('bash')
+optdepends=('perl: use perl based examples')
+replaces=('acpid2')
+backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything')
+source=("http://downloads.sourceforge.net/sourceforge/acpid2/$pkgname-$pkgver.tar.xz"
+ 'acpid.socket'
+ 'acpid.service'
+ 'anything'
+ 'handler.sh')
+md5sums=('0b07a982e3e28cf37645f2c6269af72e'
+ 'd11700eb136e0489835ddaf977a7905b'
+ '79cc7a9dceacdeffd51f070c2ba5f023'
+ '2d37b98d6e74bab815604b8b48c6cfd4'
+ '47f44ff5f02685dce8bcdab8568f0c38')
+
+build() {
+ cd $pkgname-$pkgver
+ ./configure --prefix=/usr --sbindir=/usr/bin
+ make
+}
+
+package() {
+ pushd $pkgname-$pkgver
+ make DESTDIR="$pkgdir" install
+ popd
+
+ # default config
+ install -Dm644 anything "$pkgdir/etc/acpi/events/anything"
+ install -Dm755 handler.sh "$pkgdir/etc/acpi/handler.sh"
+
+ # systemd
+ install -Dm644 acpid.socket "$pkgdir/usr/lib/systemd/system/acpid.socket"
+ install -Dm644 acpid.service "$pkgdir/usr/lib/systemd/system/acpid.service"
+
+ # fix acpid rights
+ chmod 755 "$pkgdir/usr/bin/acpid"
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/community/acpid/acpid.service b/community/acpid/acpid.service
new file mode 100644
index 000000000..022f72a71
--- /dev/null
+++ b/community/acpid/acpid.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ACPI event daemon
+Requires=acpid.socket
+
+[Service]
+ExecStart=/usr/bin/acpid -f
+
+[Install]
+WantedBy=multi-user.target
+Also=acpid.socket
diff --git a/community/acpid/acpid.socket b/community/acpid/acpid.socket
new file mode 100644
index 000000000..1b23f8735
--- /dev/null
+++ b/community/acpid/acpid.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=ACPID Listen Socket
+
+[Socket]
+ListenStream=/var/run/acpid.socket
+
+[Install]
+WantedBy=sockets.target
diff --git a/community/acpid/anything b/community/acpid/anything
new file mode 100644
index 000000000..d1828989b
--- /dev/null
+++ b/community/acpid/anything
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=.*
+action=/etc/acpi/handler.sh %e
diff --git a/community/acpid/handler.sh b/community/acpid/handler.sh
new file mode 100644
index 000000000..bab144d03
--- /dev/null
+++ b/community/acpid/handler.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Default acpi script that takes an entry for all actions
+
+case "$1" in
+ button/power)
+ case "$2" in
+ PBTN|PWRF)
+ logger 'PowerButton pressed'
+ ;;
+ *)
+ logger "ACPI action undefined: $2"
+ ;;
+ esac
+ ;;
+ button/sleep)
+ case "$2" in
+ SLPB|SBTN)
+ logger 'SleepButton pressed'
+ ;;
+ *)
+ logger "ACPI action undefined: $2"
+ ;;
+ esac
+ ;;
+ ac_adapter)
+ case "$2" in
+ AC|ACAD|ADP0)
+ case "$4" in
+ 00000000)
+ logger 'AC unpluged'
+ ;;
+ 00000001)
+ logger 'AC pluged'
+ ;;
+ esac
+ ;;
+ *)
+ logger "ACPI action undefined: $2"
+ ;;
+ esac
+ ;;
+ battery)
+ case "$2" in
+ BAT0)
+ case "$4" in
+ 00000000)
+ logger 'Battery online'
+ ;;
+ 00000001)
+ logger 'Battery offline'
+ ;;
+ esac
+ ;;
+ CPU0)
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/lid)
+ case "$3" in
+ close)
+ logger 'LID closed'
+ ;;
+ open)
+ logger 'LID opened'
+ ;;
+ *)
+ logger "ACPI action undefined: $3"
+ ;;
+ esac
+ ;;
+ *)
+ logger "ACPI group/action undefined: $1 / $2"
+ ;;
+esac
+
+# vim:set ts=4 sw=4 ft=sh et: