[acpid] Added support for systemd-loginctl list-sessions

Jaroslav Škarvada jskarvad at fedoraproject.org
Thu Jun 14 08:50:39 UTC 2012


commit b8a715fc3f67adbaeac29259e9a7ca40db7456c5
Author: Jaroslav Škarvada <jskarvad at redhat.com>
Date:   Thu Jun 14 10:50:36 2012 +0200

    Added support for systemd-loginctl list-sessions
    
      Resolves: rhbz#819559

 acpid.power.sh |   11 ++++++++++-
 acpid.spec     |    6 +++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/acpid.power.sh b/acpid.power.sh
index dfd2a6d..a8e0b18 100644
--- a/acpid.power.sh
+++ b/acpid.power.sh
@@ -2,7 +2,16 @@
 
 PATH=/sbin:/bin:/usr/bin
 
-# Get the ID of the first active X11 session:
+# Check session status using systemd
+session_ids=$(systemd-loginctl list-sessions 2>/dev/null | awk '{print $1}')
+for session in ${session_ids} ; do
+	session_status=$(systemd-loginctl session-status ${session})
+	if [ -n "$(echo "${session_status}" | grep "Active: yes" 2> /dev/null)" ]; then
+		echo "${session_status}" | grep -e '\(gnome-settings-daemon\|kded4\|xfce4-power-manager\)' >& /dev/null && exit 0
+	fi
+done
+
+# Get the ID of the first active X11 session: using ConsoleKit
 uid_session=$(
 ck-list-sessions | \
 awk '
diff --git a/acpid.spec b/acpid.spec
index f74f774..8c68472 100644
--- a/acpid.spec
+++ b/acpid.spec
@@ -1,7 +1,7 @@
 Summary: ACPI Event Daemon
 Name: acpid
 Version: 2.0.16
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 Group: System Environment/Daemons
 Source: http://tedfelix.com/linux/acpid-%{version}.tar.xz
@@ -129,6 +129,10 @@ fi
 
 
 %changelog
+* Thu Jun 14 2012 Jaroslav Škarvada <jskarvad at redhat.com> - 2.0.16-2
+- Added support for systemd-loginctl list-sessions
+  Resolves: rhbz#819559
+
 * Thu Mar 29 2012 Jaroslav Škarvada <jskarvad at redhat.com> - 2.0.16-1
 - New version
 


More information about the scm-commits mailing list