acpid: new package

This commit is contained in:
suvari
2016-07-02 17:13:07 +03:00
parent b783ba44b2
commit 04e5068eb0
14 changed files with 270 additions and 2 deletions
@@ -0,0 +1,42 @@
#!/bin/bash
#
# check if a X session is running and active.
# If not, shut down the system
#
# Copyright (C) 2008 Holger Macht <hmacht@suse.de>
#
# This file is released under the GPLv2.
#
EXEC="/sbin/shutdown -h now"
# iterate over all sessions. If a active X session is found, do nothing
while read A; do
SESSION=`echo $A | sed 's/\(Session[0-9]*\)://g'`
[ -z "$SESSION" ] || continue
SESSION=`echo $A | sed 's/\(Session[0-9]*\):/\1/g'`
IS_X=`dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit \
/org/freedesktop/ConsoleKit/$SESSION \
org.freedesktop.ConsoleKit.Session.GetX11Display`
# check if this is a X session, if not, go on
DISP=`echo $IS_X | sed -e 's/^.* string "\(.*\)"/\1/'`
[ -n "$DISP" ] || continue
IS_ACTIVE=`dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit \
/org/freedesktop/ConsoleKit/$SESSION \
org.freedesktop.ConsoleKit.Session.IsActive`
IS_ACTIVE=`echo $IS_ACTIVE | sed -e 's/^.* boolean \(.*\)$/\1/'`
if [ "$IS_ACTIVE" = "true" -a -n "$DISP" ]; then
# additional check, if none of these two apps are running, go on
if [ -n "`pidof kded4`" -o -n "`pidof gnome-power-manager`" -o -n "`pidof guidance-power-manager`" -o -n "`pidof kpowersave`" -o -n "`pidof dalston-power-applet`" ]; then
echo doing nothing...
exit 0
fi
fi
done < <(ck-list-sessions)
logger -s -t acpid "Power Button pressed, executing $EXEC"
$EXEC
@@ -0,0 +1,24 @@
diff -up acpid-2.0.15/Makefile.am.mk acpid-2.0.15/Makefile.am
--- acpid-2.0.15/Makefile.am.mk 2012-02-17 04:37:12.109907134 +0100
+++ acpid-2.0.15/Makefile.am 2012-03-16 11:27:15.127573044 +0100
@@ -20,7 +20,7 @@ acpi_listen_SOURCES = acpi_listen.c log.
dist_man8_MANS = acpid.8 acpi_listen.8
-dist_doc_DATA = COPYING Changelog README TESTPLAN TODO
+dist_doc_DATA =
# Just docs to add to the dist.
# One problem with this is that it includes all files in the samples dir
diff -up acpid-2.0.15/Makefile.in.mk acpid-2.0.15/Makefile.in
--- acpid-2.0.15/Makefile.in.mk 2012-03-16 11:28:53.568421905 +0100
+++ acpid-2.0.15/Makefile.in 2012-03-16 11:29:21.679378750 +0100
@@ -276,7 +276,7 @@ acpid_SOURCES = acpid.c acpi_ids.c conne
acpi_listen_SOURCES = acpi_listen.c log.c ud_socket.c
dist_man8_MANS = acpid.8 acpi_listen.8
-dist_doc_DATA = COPYING Changelog README TESTPLAN TODO
+dist_doc_DATA =
# Just docs to add to the dist.
# One problem with this is that it includes all files in the samples dir
@@ -0,0 +1,5 @@
# ACPID config to power down machine if powerbutton is pressed, but only if
# no gnome-power-manager, kded4, kpowersave, guidance-power-manager is running
event=button/power.*
action=/etc/acpi/actions/power.sh
@@ -0,0 +1,18 @@
[Unit]
Description=ACPI Event Daemon
After=syslog.target
# This could probably benefit from socket activation, but honestly I think it
# is time for acpid to go away, and hence I am not planning to spend the time
# to add socket activation here. We use Type=forking to ensure that the
# communication sockets are in place before boot proceeds with any service
# needing this service. Would acpid support socket activation we could use
# Type=simple here.
[Service]
Type=forking
EnvironmentFile=/etc/conf.d/acpid
ExecStart=/usr/sbin/acpid $OPTIONS
[Install]
WantedBy=multi-user.target
@@ -0,0 +1 @@
OPTIONS=
@@ -0,0 +1,6 @@
# Configuration to turn on DPMS again on video activity, needed for some
# laptops. Disabled by default, uncomment if your laptop display stays blank
# after you close and open the lid.
#event=video.*
#action=/usr/sbin/vbetool dpms on