diff --git a/community/acpid/APKBUILD b/community/acpid/APKBUILD index 0d50a6507f1bc246bac25640df0d22a0ef019e06..c42378f3b252ca76a0bc91cde172cbd9c97cdd17 100644 --- a/community/acpid/APKBUILD +++ b/community/acpid/APKBUILD @@ -2,16 +2,11 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=acpid pkgver=2.0.33 -pkgrel=3 +pkgrel=4 pkgdesc="The ACPI Daemon (acpid) With Netlink Support" url="https://sourceforge.net/projects/acpid2/" arch="all" license="GPL-2.0-or-later" -# zzz is used in provided handler.sh; it's not required by acpid itself and -# it's only useful for notebooks/desktops/alike, but we can assume that this -# acpid package will be mostly used on such devices (others will just use -# busybox acpid which is installed by default). -depends="zzz" makedepends="linux-headers" install="$pkgname.post-deinstall" subpackages="$pkgname-doc $pkgname-openrc" @@ -19,6 +14,7 @@ source="https://downloads.sourceforge.net/sourceforge/acpid2/acpid-$pkgver.tar.x handler.sh power-supply-ac lid-closed + suspend anything $pkgname.initd $pkgname.confd @@ -42,9 +38,13 @@ package() { cd "$pkgdir" - install -D -m 755 "$srcdir"/handler.sh etc/acpi/handler.sh - install -D -m 644 "$srcdir"/anything etc/acpi/events/anything - install -D -m 755 "$srcdir"/power-supply-ac "$srcdir"/lid-closed -t usr/share/acpid/ + install -D -m 755 "$srcdir"/handler.sh -t etc/acpi/ + install -D -m 644 "$srcdir"/anything -t etc/acpi/events/ + + install -D -m 755 -t usr/share/acpid/ \ + "$srcdir"/lid-closed \ + "$srcdir"/power-supply-ac \ + "$srcdir"/suspend install -D -m 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname install -D -m 644 "$srcdir"/$pkgname.confd etc/conf.d/$pkgname @@ -57,9 +57,10 @@ openrc() { sha512sums=" 491a58c62fcad44dc57cbd9294437fbc215c2ec99a030286601cd1956ea504e723e61b11b315983073d66aace1997bc40e6421475f6073298f60b8dcda2add75 acpid-2.0.33.tar.xz -41b206253f49ae587ff8436c307b453a88e0751fbd3c8e75a3af27b92113b3496c9fb59cb7daed06339005ef70735d8d1eb0c0c6c42b52b700992dcb28217757 handler.sh +050c81446ac563d5d4c5d63a3e0b41558d5934427589114dc8b3215b72a1bd5923e0b8812e6d2265a6f53b6b0bcf8d7cc84d8ea6f2993ceea49c3c864c89c42c handler.sh daf2510f202377a4db9b52448e4805bc4468c66f507cd4e676dc589306b716043c653ff18b697a4c37e5a005123a64a0278f3e4980504d98dd42ac9e95a3443f power-supply-ac f6df3e75198e779826c187038804ba80e7a445567342ac912ff4e5d894ce936fb9347146c302c7d7c9bbc8b3a0e47aeee9d23a4b297ee37e3938b7310a1b5ad9 lid-closed +8ec95453c21c5801a0864a5a91fd1d714f29d10a50658e93f027a395dcff91cd0e1ea5047ece199131e6205a422ae6f1887b388068630a0579995e3069d6a3bd suspend 2e04e5c8a428bfc653b4d56f5a2ff4472169a094ed9eee4b02ea88c755848e4803a0edeb054e152516ee50cb67c8c2be2c43e2e9db9dc80b7fcf218b8907ef6c anything c647112006486abb469fdb60c2a91699e6922dac8b09642fa70d4341c9029748f99539d5befc8951adf57a6b382cf5a65adfd208bc2f19cab39b680120504e61 acpid.initd b8f62dc7d5a2d1338936af79b3e7165cc1c652be0be9e7f8eb00d964c1c1ef91767f16e8662eaa77920d914b966ae208c8480e44cb2dca0de4bfed01f302a089 acpid.confd diff --git a/community/acpid/handler.sh b/community/acpid/handler.sh index 2530acbc662bdbe7f3a00c60087bce02ae62390d..9a6cbafec06100be59855226fb615a8a7f2b6ea7 100644 --- a/community/acpid/handler.sh +++ b/community/acpid/handler.sh @@ -1,10 +1,13 @@ #!/bin/sh -# vim: set ts=4: +# vim: set ts=4 sw=4: # # This is the default ACPI handler script that is configured in # /etc/acpi/events/anything to be called for every ACPI event. # You can edit it and add your own actions; treat it as a configuration file. # +# lid-closed, power-supply-ac and suspend are scripts located in +# /usr/share/acpid/. +# PATH="/usr/share/acpid:$PATH" alias log='logger -t acpid' @@ -15,25 +18,24 @@ button/power:PWRF:* | button/power:PBTN:*) log 'Power button pressed' # If we have a lid (notebook), suspend to RAM, otherwise power off. if [ -e /proc/acpi/button/lid/LID ]; then - zzz + suspend else poweroff fi ;; button/sleep:SLPB:*) log 'Sleep button pressed' - # Suspend to RAM. - zzz + suspend ;; button/lid:*:close:*) log 'Lid closed' # Suspend to RAM if AC adapter is not connected. - power-supply-ac || zzz + power-supply-ac || suspend ;; ac_adapter:*:*:*0) log 'AC adapter unplugged' # Suspend to RAM if notebook's lid is closed. - lid-closed && zzz + lid-closed && suspend ;; esac diff --git a/community/acpid/suspend b/community/acpid/suspend new file mode 100644 index 0000000000000000000000000000000000000000..f787037da67d79b81e4433214df21101f7f15527 --- /dev/null +++ b/community/acpid/suspend @@ -0,0 +1,7 @@ +#!/bin/sh + +if command -v zzz >/dev/null; then + zzz "$@" +else + echo 'mem' > /sys/power/state +fi