diff options
Diffstat (limited to 'community/acpid')
-rw-r--r-- | community/acpid/PKGBUILD | 39 | ||||
-rw-r--r-- | community/acpid/acpid.conf | 5 | ||||
-rw-r--r-- | community/acpid/acpid.rc | 40 | ||||
-rw-r--r-- | community/acpid/acpid.service | 7 | ||||
-rw-r--r-- | community/acpid/acpid.socket | 8 | ||||
-rw-r--r-- | community/acpid/handler.sh | 62 |
6 files changed, 124 insertions, 37 deletions
diff --git a/community/acpid/PKGBUILD b/community/acpid/PKGBUILD index 53ff54a87..677e10b47 100644 --- a/community/acpid/PKGBUILD +++ b/community/acpid/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 69396 2012-04-15 17:01:41Z seblu $ +# $Id: PKGBUILD 70904 2012-05-18 22:37:04Z seblu $ # Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org> # Contributor: xduugu # Contributor: Manolis Tzanidakis @@ -6,7 +6,7 @@ pkgname=acpid pkgver=2.0.16 -pkgrel=1 +pkgrel=2 pkgdesc='A daemon for delivering ACPI power management events with netlink support' arch=('i686' 'x86_64') url='http://tedfelix.com/linux/acpid-netlink.html' @@ -16,15 +16,19 @@ optdepends=('perl: use perl based examples') replaces=('acpid2') backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything' 'etc/conf.d/acpid') source=("http://www.tedfelix.com/linux/$pkgname-$pkgver.tar.xz" - 'acpid' + 'acpid.rc' + 'acpid.conf' + 'acpid.socket' + 'acpid.service' 'anything' - 'handler.sh' - 'acpid.conf.d') + 'handler.sh') md5sums=('d59fc02c9c34f0d5c137495302e2c074' - 'd69203a032c4583f9abaafcf21a7ed84' + '077475c75fbdd9de75f9a397130ccd91' + '929c6d2e91295c22ed9ec6212d7eabef' + 'ee6cb99e50e580c50331a73045412ae9' + '953e26477c5d4f5f013d6861c04b4af6' '2d37b98d6e74bab815604b8b48c6cfd4' - '615439f4a89716c747907d4fc3c8df75' - '929c6d2e91295c22ed9ec6212d7eabef') + '74ee3c33714ff5cb44f30c9a0dceeef0') build() { cd $pkgname-$pkgver @@ -33,15 +37,22 @@ build() { } package() { - cd $pkgname-$pkgver + 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" - install -Dm755 ../acpid "$pkgdir/etc/rc.d/acpid" - install -Dm644 ../anything "$pkgdir/etc/acpi/events/anything" - install -Dm755 ../handler.sh "$pkgdir/etc/acpi/handler.sh" - install -Dm644 ../acpid.conf.d "$pkgdir/etc/conf.d/acpid" + # initscripts + install -Dm755 acpid.rc "$pkgdir/etc/rc.d/acpid" + install -Dm644 acpid.conf "$pkgdir/etc/conf.d/acpid" + install -Dm644 acpid.socket "$pkgdir/usr/lib/systemd/system/acpid.socket" + install -Dm644 acpid.service "$pkgdir/usr/lib/systemd/system/acpid.service" - chmod 755 "$pkgdir"/usr/sbin/acpid + # fix acpid rights + chmod 755 "$pkgdir/usr/sbin/acpid" } # vim:set ts=2 sw=2 ft=sh et: diff --git a/community/acpid/acpid.conf b/community/acpid/acpid.conf new file mode 100644 index 000000000..b60103a2d --- /dev/null +++ b/community/acpid/acpid.conf @@ -0,0 +1,5 @@ +# +# Arguments to be passed to the acpid daemon +# + +ACPID_ARGS="" diff --git a/community/acpid/acpid.rc b/community/acpid/acpid.rc new file mode 100644 index 000000000..674f4621b --- /dev/null +++ b/community/acpid/acpid.rc @@ -0,0 +1,40 @@ +#!/bin/bash + +. /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 $ACPID_ARGS + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon acpid + stat_done + fi + ;; + stop) + stat_busy "Stopping acpid" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon acpid + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/community/acpid/acpid.service b/community/acpid/acpid.service new file mode 100644 index 000000000..31fcc0575 --- /dev/null +++ b/community/acpid/acpid.service @@ -0,0 +1,7 @@ +[Unit] +Description=ACPI event daemon +Requires=acpid.socket + +[Service] +EnvironmentFile=/etc/conf.d/acpid +ExecStart=/usr/sbin/acpid -f $ACPID_ARGS diff --git a/community/acpid/acpid.socket b/community/acpid/acpid.socket new file mode 100644 index 000000000..1e5365bf1 --- /dev/null +++ b/community/acpid/acpid.socket @@ -0,0 +1,8 @@ +[Unit] +Description=ACPID Listen Socket + +[Socket] +ListenStream=/run/acpid.socket + +[Install] +WantedBy=sockets.target diff --git a/community/acpid/handler.sh b/community/acpid/handler.sh index aac143a9a..b5a548f43 100644 --- a/community/acpid/handler.sh +++ b/community/acpid/handler.sh @@ -9,16 +9,24 @@ set $* case "$1" in button/power) - #echo "PowerButton pressed!">/dev/tty5 case "$2" in - PBTN|PWRF) logger "PowerButton pressed: $2" ;; - *) logger "ACPI action undefined: $2" ;; + PBTN|PWRF) + logger "PowerButton pressed: $2" + poweroff + ;; + *) + logger "ACPI action undefined: $2" + ;; esac ;; button/sleep) case "$2" in - SLPB|SBTN) echo -n mem >/sys/power/state ;; - *) logger "ACPI action undefined: $2" ;; + SLPB|SBTN) + echo -n mem >/sys/power/state + ;; + *) + logger "ACPI action undefined: $2" + ;; esac ;; ac_adapter) @@ -28,43 +36,51 @@ case "$1" 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" ;; + *) + logger "ACPI action undefined: $2" + ;; esac ;; battery) case "$2" in BAT0) case "$4" in - 00000000) #echo "offline" >/dev/tty5 - ;; - 00000001) #echo "online" >/dev/tty5 - ;; + 00000000) + logger 'Battery online' + ;; + 00000001) + logger 'Battery offline' + ;; esac ;; - CPU0) + CPU0) ;; *) logger "ACPI action undefined: $2" ;; esac ;; button/lid) - case "$3" in - close) - #echo "LID closed!">/dev/tty5 - ;; - open) - #echo "LID opened!">/dev/tty5 - ;; - esac - ;; - + 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: |