forked from pool/acpid
- Catch and process sleep event correctly, even if no X is
running. OBS-URL: https://build.opensuse.org/package/show/Base:System/acpid?expand=0&rev=56
This commit is contained in:
parent
fca6a593a4
commit
8d611ed792
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 15 15:29:10 UTC 2013 - trenn@suse.de
|
||||||
|
|
||||||
|
- Catch and process sleep event correctly, even if no X is
|
||||||
|
running.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Sep 23 04:00:57 UTC 2012 - crrodriguez@opensuse.org
|
Sun Sep 23 04:00:57 UTC 2012 - crrodriguez@opensuse.org
|
||||||
|
|
||||||
|
13
acpid.spec
13
acpid.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package acpid
|
# spec file for package acpid
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -16,6 +16,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Name: acpid
|
Name: acpid
|
||||||
Version: 2.0.17
|
Version: 2.0.17
|
||||||
Release: 0
|
Release: 0
|
||||||
@ -28,10 +29,13 @@ Source2: rcacpid
|
|||||||
Source3: README.SuSE
|
Source3: README.SuSE
|
||||||
Source4: thinkpad_acpi.modprobe
|
Source4: thinkpad_acpi.modprobe
|
||||||
Source5: events.power_button
|
Source5: events.power_button
|
||||||
Source9: events.thinkpad
|
|
||||||
Source6: thinkpad_handler
|
Source6: thinkpad_handler
|
||||||
Source7: power_button
|
Source7: power_button
|
||||||
Source8: acpid.service
|
Source8: acpid.service
|
||||||
|
Source9: events.thinkpad
|
||||||
|
Source10: events.sleep_button
|
||||||
|
Source11: sleep_button
|
||||||
|
|
||||||
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
|
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
|
||||||
Patch1: acpid-makefile.patch
|
Patch1: acpid-makefile.patch
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -54,7 +58,7 @@ Configure it in /etc/sysconfig/powermanagement.
|
|||||||
%setup -q
|
%setup -q
|
||||||
%patch1
|
%patch1
|
||||||
|
|
||||||
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE9} .
|
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE9} %{SOURCE10} %{SOURCE11} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export LDFLAGS="-Wl,-z,relro,-z,now"
|
export LDFLAGS="-Wl,-z,relro,-z,now"
|
||||||
@ -67,9 +71,11 @@ install -Dm 744 rcacpid %{buildroot}%{_initddir}/acpid
|
|||||||
install -Dm 644 thinkpad_acpi.modprobe %{buildroot}%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
|
install -Dm 644 thinkpad_acpi.modprobe %{buildroot}%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
|
||||||
install -Dm 744 thinkpad_handler %{buildroot}%{_prefix}/lib/acpid/thinkpad_handler
|
install -Dm 744 thinkpad_handler %{buildroot}%{_prefix}/lib/acpid/thinkpad_handler
|
||||||
install -Dm 744 power_button %{buildroot}%{_prefix}/lib/acpid/power_button
|
install -Dm 744 power_button %{buildroot}%{_prefix}/lib/acpid/power_button
|
||||||
|
install -Dm 744 sleep_button %{buildroot}%{_prefix}/lib/acpid/sleep_button
|
||||||
mkdir -p %{buildroot}%{_prefix}/sbin
|
mkdir -p %{buildroot}%{_prefix}/sbin
|
||||||
ln -sf ../../etc/init.d/acpid %{buildroot}%{_sbindir}/rcacpid
|
ln -sf ../../etc/init.d/acpid %{buildroot}%{_sbindir}/rcacpid
|
||||||
install -Dm 644 events.power_button %{buildroot}%{_sysconfdir}/acpi/events/power_button
|
install -Dm 644 events.power_button %{buildroot}%{_sysconfdir}/acpi/events/power_button
|
||||||
|
install -Dm 644 events.sleep_button %{buildroot}%{_sysconfdir}/acpi/events/sleep_button
|
||||||
install -Dm 644 events.thinkpad %{buildroot}%{_sysconfdir}/acpi/events/thinkpad
|
install -Dm 644 events.thinkpad %{buildroot}%{_sysconfdir}/acpi/events/thinkpad
|
||||||
mkdir -p %{buildroot}/%{_unitdir}
|
mkdir -p %{buildroot}/%{_unitdir}
|
||||||
install -m 644 %{SOURCE8} %{buildroot}/%{_unitdir}
|
install -m 644 %{SOURCE8} %{buildroot}/%{_unitdir}
|
||||||
@ -103,6 +109,7 @@ touch %{buildroot}%{_localstatedir}/log/acpid
|
|||||||
%dir %{_sysconfdir}/acpi/events
|
%dir %{_sysconfdir}/acpi/events
|
||||||
%{_sysconfdir}/acpi/events/thinkpad
|
%{_sysconfdir}/acpi/events/thinkpad
|
||||||
%{_sysconfdir}/acpi/events/power_button
|
%{_sysconfdir}/acpi/events/power_button
|
||||||
|
%{_sysconfdir}/acpi/events/sleep_button
|
||||||
%{_prefix}/lib/acpid
|
%{_prefix}/lib/acpid
|
||||||
%{_sysconfdir}/init.d/acpid
|
%{_sysconfdir}/init.d/acpid
|
||||||
%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
|
%{_sysconfdir}/modprobe.d/50-thinkpad_acpi.conf
|
||||||
|
5
events.sleep_button
Normal file
5
events.sleep_button
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# handle sleep button event
|
||||||
|
|
||||||
|
event=button/sleep.*
|
||||||
|
action=/usr/lib/acpid/sleep_button
|
||||||
|
|
42
sleep_button
Normal file
42
sleep_button
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Sleep button suspend script, adapted from
|
||||||
|
# /usr/lib/acpid/power_button
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008 Holger Macht <hmacht@suse.de>
|
||||||
|
#
|
||||||
|
# This file is released under the GPLv2.
|
||||||
|
#
|
||||||
|
|
||||||
|
EXEC=/usr/sbin/pm-suspend
|
||||||
|
|
||||||
|
# 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 kpowersave`" -o -n "`pidof gnome-power-manager`" -o -n "`pidof kded4`" ]; then
|
||||||
|
echo doing nothing...
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < <(ck-list-sessions)
|
||||||
|
|
||||||
|
logger -s "Sleep Button event received, running $EXEC."
|
||||||
|
$EXEC
|
Loading…
x
Reference in New Issue
Block a user