Revert "ConsoleKit2: update to 0.9.3."

This reverts commit 1a9f0fc184.

0.9.3 does not work correctly... revert this until the issue is found.
This commit is contained in:
Juan RP 2015-06-11 09:50:48 +02:00
parent 1a9f0fc184
commit 6d002f66d7
14 changed files with 2847 additions and 10 deletions

View File

@ -0,0 +1,140 @@
From cfea98feebc9b1668d555d98481698dc4eefe532 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Tue, 11 Nov 2014 19:20:43 +0300
Subject: [PATCH 01/12] Fix installing logrotate file
This ensures the logrotate file will rotate the history file correctly.
It also now installs to the right location.
---
.gitignore | 1 +
configure.ac | 13 -------------
data/Makefile.am | 34 +++++++++++++++++++++++++++++-----
data/consolekit.logrotate | 8 --------
data/consolekit.logrotate.in | 8 ++++++++
5 files changed, 38 insertions(+), 26 deletions(-)
delete mode 100644 data/consolekit.logrotate
create mode 100644 data/consolekit.logrotate.in
diff --git a/configure.ac b/configure.ac
index 8516c53..12cb074 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,18 +287,6 @@ else
fi
AC_SUBST(PAM_MODULE_DIR)
-dnl ---------------------------------------------------------------------------
-dnl - Install directory for syslog rotation file
-dnl ---------------------------------------------------------------------------
-
-AC_ARG_WITH(logrotate-dir,
- [AS_HELP_STRING([--with-logrotate-dir=<dir>],[directory to install syslog rotation file])])
-if ! test -z "$with_logrotate_dir"; then
- LOGROTATE_DIR="$with_logrotate_dir"
-else
- LOGROTATE_DIR="/etc/logrotate.d"
-fi
-AC_SUBST(LOGROTATE_DIR)
dnl ---------------------------------------------------------------------------
dnl - Install directory for xinitrc file
@@ -527,7 +515,6 @@ echo "
Build PAM module: ${msg_pam_module}
Build udev-acl: ${enable_udev_acl}
Build docs: ${enable_docbook_docs}
- Log rotate dir: ${LOGROTATE_DIR}
xinitrc dir: ${XINITRC_DIR}
PolicyKit support ${have_polkit}
diff --git a/data/Makefile.am b/data/Makefile.am
index 173df0e..38876d5 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,12 +1,13 @@
NULL =
+BUILT_SOURCES =
+
dbusconfdir = $(DBUS_SYS_DIR)
dbusconf_DATA = ConsoleKit.conf
seatdir = $(sysconfdir)/ConsoleKit/seats.d
seat_DATA = 00-primary.seat
-logdir = $(LOGROTATE_DIR)
xinitrcdir = $(XINITRC_DIR)
if HAVE_POLKIT
@@ -72,14 +73,35 @@ edit = sed \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'
-
-install-log:
- $(INSTALL_PROGRAM) consolekit.logrotate $(logdir)
-
install-xinitrc:
$(INSTALL_PROGRAM) 90-consolekit $(xinitrcdir) && \
chmod +x $(xinitrcdir)/90-consolekit
+install-data-local: install-logrotate
+ $(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/
+
+uninstall-local:: uninstall-logrotate
+ rmdir $(DESTDIR)$(localstatedir)/log/ConsoleKit/
+
+LOGROTATE_CONFS = consolekit.logrotate
+
+BUILT_SOURCES += $(LOGROTATE_CONFS)
+
+consolekit.logrotate: consolekit.logrotate.in
+ sed \
+ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
+ < $< > $@-t
+ mv $@-t $@
+
+install-logrotate: $(LOGROTATE_CONFS)
+ $(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/ \
+ $(DESTDIR)$(sysconfdir)/logrotate.d/
+ $(INSTALL_DATA) consolekit.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit
+
+
+uninstall-logrotate:
+ rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit
+
EXTRA_DIST = \
ck-log-system-restart \
ck-log-system-start \
@@ -92,6 +114,7 @@ EXTRA_DIST = \
console-kit-log-system-stop.service.in \
console-kit-log-system-restart.service.in \
90-consolekit \
+ consolekit.logrotate.in \
$(NULL)
MAINTAINERCLEANFILES = \
@@ -100,6 +123,7 @@ MAINTAINERCLEANFILES = \
CLEANFILES = \
$(service_DATA) \
+ $(BUILT_SOURCES) \
console-kit-daemon.service \
console-kit-log-system-start.service \
console-kit-log-system-stop.service \
diff --git a/data/consolekit.logrotate.in b/data/consolekit.logrotate.in
new file mode 100644
index 0000000..656b312
--- /dev/null
+++ b/data/consolekit.logrotate.in
@@ -0,0 +1,8 @@
+@localstatedir@/log/ConsoleKit/history {
+ monthly
+ rotate 6
+ delaycompress
+ compress
+ notifempty
+ missingok
+}
--
2.2.1

View File

@ -0,0 +1,62 @@
From 856e442af8f03168b6a8425fcb06bb685c663af8 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 10 Nov 2014 11:58:36 +0300
Subject: [PATCH 02/12] Conditionally add the SystemdService
Add the SystemdService service tag to the consolekit service file
if we're being built with systemd support.
---
data/Makefile.am | 17 ++++++++++++-----
data/org.freedesktop.ConsoleKit.service.in | 2 +-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/data/Makefile.am b/data/Makefile.am
index 38876d5..acb381f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -24,6 +24,12 @@ service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
$(edit) $< >$@
+edit = sed \
+ -e 's|@sbindir[@]|$(sbindir)|g' \
+ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@localstatedir[@]|$(localstatedir)|g' \
+ -e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'
+
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
console-kit-daemon.service \
@@ -65,13 +71,14 @@ install-data-hook:
( cd $(DESTDIR)$(systemdsystemunitdir)/kexec.target.wants && \
rm -f console-kit-log-system-restart.service && \
$(LN_S) ../console-kit-log-system-restart.service )
+
+edit += \
+ -e 's|@SystemdService[@]|SystemdService=console-kit-daemon.service|g'
+else
+edit += \
+ -e 's|@SystemdService[@]||g'
endif
-edit = sed \
- -e 's|@sbindir[@]|$(sbindir)|g' \
- -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
- -e 's|@localstatedir[@]|$(localstatedir)|g' \
- -e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'
install-xinitrc:
$(INSTALL_PROGRAM) 90-consolekit $(xinitrcdir) && \
diff --git a/data/org.freedesktop.ConsoleKit.service.in b/data/org.freedesktop.ConsoleKit.service.in
index 5e35ebb..f5f55dc 100644
--- a/data/org.freedesktop.ConsoleKit.service.in
+++ b/data/org.freedesktop.ConsoleKit.service.in
@@ -2,4 +2,4 @@
Name=org.freedesktop.ConsoleKit
Exec=@sbindir@/console-kit-daemon --no-daemon
User=root
-SystemdService=console-kit-daemon.service
+@SystemdService@
--
2.2.1

View File

@ -0,0 +1,187 @@
From 2c1f7c245a2592b94b8a19d380a77ad1326a7ea4 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 10 Nov 2014 15:53:36 +0300
Subject: [PATCH 03/12] Fix installing 90-consolekit file
This ensures the 90-consolekit file will be installed to the
right location.
---
.gitignore | 1 +
configure.ac | 2 +-
data/90-consolekit | 32 --------------------------------
data/90-consolekit.in | 32 ++++++++++++++++++++++++++++++++
data/Makefile.am | 31 ++++++++++++++++++++++---------
5 files changed, 56 insertions(+), 42 deletions(-)
delete mode 100644 data/90-consolekit
create mode 100644 data/90-consolekit.in
diff --git a/configure.ac b/configure.ac
index 12cb074..d45a937 100644
--- a/configure.ac
+++ b/configure.ac
@@ -297,7 +297,7 @@ AC_ARG_WITH(xinitrc-dir,
if ! test -z "$with_xinitrc_dir"; then
XINITRC_DIR="$with_xinitrc_dir"
else
- XINITRC_DIR="/etc/X11/xinit/xinitrc.d"
+ XINITRC_DIR="$sysconfdir/X11/xinit/xinitrc.d"
fi
AC_SUBST(XINITRC_DIR)
diff --git a/data/90-consolekit b/data/90-consolekit
deleted file mode 100644
index f0082a7..0000000
--- a/data/90-consolekit
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- sh -*-
-# Xsession.d script for ck-launch-session.
-#
-#
-# This file is sourced by Xsession(5), not executed.
-
-CK_LAUNCH_SESSION=/usr/bin/ck-launch-session
-
-is_on_console() {
- session=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
- --type=method_call --print-reply --reply-timeout=2000 \
- /org/freedesktop/ConsoleKit/Manager \
- org.freedesktop.ConsoleKit.Manager.GetCurrentSession \
- | grep path | awk '{print $3}' | sed s/\"//g)
- x11_display=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
- --type=method_call --print-reply --reply-timeout=2000 \
- $session org.freedesktop.ConsoleKit.Session.GetX11Display \
- | grep string | awk '{print $2}' | sed s/\"//g)
-
- if [ -z "$x11_display" ] ; then
- return 0
- else
- return 1
- fi
-}
-
-# gdm already creates a CK session for us, so do not run the expensive D-Bus
-# calls if we have $GDMSESSION
-if [ -z "$GDMSESSION" ] && [ -x "$CK_LAUNCH_SESSION" ] && \
- ( [ -z "$XDG_SESSION_COOKIE" ] || is_on_console ) ; then
- STARTUP="$CK_LAUNCH_SESSION $STARTUP"
-fi
diff --git a/data/90-consolekit.in b/data/90-consolekit.in
new file mode 100644
index 0000000..30847b2
--- /dev/null
+++ b/data/90-consolekit.in
@@ -0,0 +1,32 @@
+# -*- sh -*-
+# Xsession.d script for ck-launch-session.
+#
+#
+# This file is sourced by Xsession(5), not executed.
+
+@CK_LAUNCH_SESSION@
+
+is_on_console() {
+ session=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
+ --type=method_call --print-reply --reply-timeout=2000 \
+ /org/freedesktop/ConsoleKit/Manager \
+ org.freedesktop.ConsoleKit.Manager.GetCurrentSession \
+ | grep path | awk '{print $3}' | sed s/\"//g)
+ x11_display=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
+ --type=method_call --print-reply --reply-timeout=2000 \
+ $session org.freedesktop.ConsoleKit.Session.GetX11Display \
+ | grep string | awk '{print $2}' | sed s/\"//g)
+
+ if [ -z "$x11_display" ] ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# gdm already creates a CK session for us, so do not run the expensive D-Bus
+# calls if we have $GDMSESSION
+if [ -z "$GDMSESSION" ] && [ -x "$CK_LAUNCH_SESSION" ] && \
+ ( [ -z "$XDG_SESSION_COOKIE" ] || is_on_console ) ; then
+ STARTUP="$CK_LAUNCH_SESSION $STARTUP"
+fi
diff --git a/data/Makefile.am b/data/Makefile.am
index acb381f..6b47655 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -8,7 +8,6 @@ dbusconf_DATA = ConsoleKit.conf
seatdir = $(sysconfdir)/ConsoleKit/seats.d
seat_DATA = 00-primary.seat
-xinitrcdir = $(XINITRC_DIR)
if HAVE_POLKIT
polkit_policydir = $(datadir)/polkit-1/actions
@@ -80,19 +79,20 @@ edit += \
endif
-install-xinitrc:
- $(INSTALL_PROGRAM) 90-consolekit $(xinitrcdir) && \
- chmod +x $(xinitrcdir)/90-consolekit
-
-install-data-local: install-logrotate
+install-data-local: install-logrotate install-90-consolekit
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/
-uninstall-local:: uninstall-logrotate
+uninstall-local:: uninstall-logrotate uninstall-90-consolekit
rmdir $(DESTDIR)$(localstatedir)/log/ConsoleKit/
LOGROTATE_CONFS = consolekit.logrotate
-BUILT_SOURCES += $(LOGROTATE_CONFS)
+XINITRC_CONFS = 90-consolekit
+
+BUILT_SOURCES += \
+ $(LOGROTATE_CONFS) \
+ $(XINITRC_CONFS) \
+ $(NULL)
consolekit.logrotate: consolekit.logrotate.in
sed \
@@ -100,15 +100,28 @@ consolekit.logrotate: consolekit.logrotate.in
< $< > $@-t
mv $@-t $@
+90-consolekit: 90-consolekit.in
+ sed \
+ -e 's![@]CK_LAUNCH_SESSION[@]!CK_LAUNCH_SESSION=$(bindir)/ck-launch-session!g' \
+ < $< > $@-t
+ mv $@-t $@
+
install-logrotate: $(LOGROTATE_CONFS)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/ \
$(DESTDIR)$(sysconfdir)/logrotate.d/
$(INSTALL_DATA) consolekit.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit
+install-90-consolekit: $(XINITRC_CONFS)
+ $(MKDIR_P) $(DESTDIR)$(XINITRC_DIR)/
+ $(INSTALL_PROGRAM) 90-consolekit $(DESTDIR)$(XINITRC_DIR) && \
+ chmod +x $(DESTDIR)$(XINITRC_DIR)/90-consolekit
uninstall-logrotate:
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/consolekit
+uninstall-90-consolekit:
+ rm -f $(DESTDIR)$(XINITRC_DIR)/90-consolekit
+
EXTRA_DIST = \
ck-log-system-restart \
ck-log-system-start \
@@ -120,7 +133,7 @@ EXTRA_DIST = \
console-kit-log-system-start.service.in \
console-kit-log-system-stop.service.in \
console-kit-log-system-restart.service.in \
- 90-consolekit \
+ 90-consolekit.in \
consolekit.logrotate.in \
$(NULL)
--
2.2.1

View File

@ -0,0 +1,25 @@
From d34e7aabd04018f70b15e54ccfffe93781f97bf6 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Wed, 12 Nov 2014 19:21:37 +0300
Subject: [PATCH 04/12] trivial: ignore non-empty log dir on uninstall
---
data/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/Makefile.am b/data/Makefile.am
index 6b47655..abd9403 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -83,7 +83,7 @@ install-data-local: install-logrotate install-90-consolekit
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/ConsoleKit/
uninstall-local:: uninstall-logrotate uninstall-90-consolekit
- rmdir $(DESTDIR)$(localstatedir)/log/ConsoleKit/
+ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(localstatedir)/log/ConsoleKit/
LOGROTATE_CONFS = consolekit.logrotate
--
2.2.1

View File

@ -0,0 +1,411 @@
From cea7cb81dd95b447a8d5cb279307c435d9dc968c Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 17 Nov 2014 10:16:26 +0300
Subject: [PATCH 05/12] Add the PrepareForSleep/Shutdown signals
This patch adds the PrepareForSleep/Shutdown signals so apps can
listed for these signals and perform operations prior to the event
such as logging out of online chatrooms.
---
po/ConsoleKit2.pot | 14 +-
src/ck-manager.c | 210 +++++++++++++++++++++++++----
src/ck-manager.h | 4 +
src/org.freedesktop.ConsoleKit.Manager.xml | 31 +++++
4 files changed, 224 insertions(+), 35 deletions(-)
diff --git a/po/ConsoleKit2.pot b/po/ConsoleKit2.pot
index 331b9e2..31f9ec7 100644
--- a/po/ConsoleKit2.pot
+++ b/po/ConsoleKit2.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://github.com/ConsoleKit2/ConsoleKit2/issues\n"
-"POT-Creation-Date: 2014-11-02 15:43+0300\n"
+"POT-Creation-Date: 2014-11-17 10:15+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -65,29 +65,29 @@ msgstr ""
msgid "No consoles available"
msgstr ""
-#: src/ck-manager.c:2516 src/ck-manager.c:2615 src/ck-manager.c:2672
+#: src/ck-manager.c:2648 src/ck-manager.c:2747 src/ck-manager.c:2804
msgid "Unable to get information about the calling process"
msgstr ""
-#: src/ck-manager.c:2529 src/ck-session.c:278
+#: src/ck-manager.c:2661 src/ck-session.c:278
#, c-format
msgid "Unable to lookup information about calling process '%d'"
msgstr ""
-#: src/ck-manager.c:2553 src/ck-manager.c:2565 src/ck-manager.c:2822
+#: src/ck-manager.c:2685 src/ck-manager.c:2697 src/ck-manager.c:2954
msgid "Unable to find session for cookie"
msgstr ""
-#: src/ck-manager.c:2629
+#: src/ck-manager.c:2761
#, c-format
msgid "Unable to lookup session information for process '%d'"
msgstr ""
-#: src/ck-manager.c:2830
+#: src/ck-manager.c:2962
msgid "User ID does not match the owner of cookie"
msgstr ""
-#: src/ck-manager.c:2840
+#: src/ck-manager.c:2972
msgid "Process ID does not match the owner of cookie"
msgstr ""
diff --git a/src/ck-manager.c b/src/ck-manager.c
index cf5a40b..0110d89 100644
--- a/src/ck-manager.c
+++ b/src/ck-manager.c
@@ -83,15 +83,31 @@ struct CkManagerPrivate
gboolean system_idle_hint;
GTimeVal system_idle_since_hint;
+ /* How long to delay after emitting the PREPARE_FOR_SHUTDOWN or
+ * PREPARE_FOR_SLEEP signal */
+ guint system_action_idle_delay;
+
CkInhibitManager *inhibit_manager;
};
-enum {
+typedef enum {
SEAT_ADDED,
SEAT_REMOVED,
SYSTEM_IDLE_HINT_CHANGED,
+ PREPARE_FOR_SHUTDOWN,
+ PREPARE_FOR_SLEEP,
LAST_SIGNAL
-};
+} SIGNALS;
+
+typedef struct
+{
+ CkManager *manager;
+ DBusGMethodInvocation *context;
+ const gchar *command;
+ CkLogEventType event_type;
+ const gchar *description;
+ SIGNALS signal;
+} SystemActionData;
static guint signals [LAST_SIGNAL] = { 0, };
@@ -1198,7 +1214,7 @@ do_system_action (CkManager *manager,
g_debug ("command is %s", command);
error = NULL;
- res = g_spawn_command_line_async (command, &error);
+ res = g_spawn_command_line_sync (command, NULL, NULL, NULL, &error);
if (! res) {
GError *new_error;
@@ -1218,15 +1234,55 @@ do_system_action (CkManager *manager,
}
}
+static gboolean
+system_action_idle_cb(SystemActionData *data)
+{
+ g_return_val_if_fail (data != NULL, FALSE);
+
+ /* Perform the action */
+ do_system_action (data->manager,
+ data->context,
+ data->command,
+ data->event_type,
+ data->description);
+
+ /* If we got here the sleep action is done and we're awake again
+ * or the operation failed. Either way we can signal to the apps */
+ g_signal_emit (data->manager, signals [data->signal], 0, FALSE);
+
+ g_free (data);
+
+ return FALSE;
+}
+
static void
do_restart (CkManager *manager,
DBusGMethodInvocation *context)
{
- do_system_action (manager,
- context,
- PREFIX "/lib/ConsoleKit/scripts/ck-system-restart",
- CK_LOG_EVENT_SYSTEM_RESTART,
- "Restart");
+ SystemActionData *data;
+
+ /* Emit the signal */
+ g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, TRUE);
+
+ /* Allocate and fill the data struct to pass to the idle cb */
+ data = g_new0 (SystemActionData, 1);
+ if (data == NULL) {
+ g_critical ("failed to allocate memory to perform shutdown\n");
+ g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, FALSE);
+ return;
+ }
+
+ data->manager = manager;
+ data->context = context;
+ data->command = PREFIX "/lib/ConsoleKit/scripts/ck-system-restart";
+ data->event_type = CK_LOG_EVENT_SYSTEM_RESTART;
+ data->description = "Restart";
+ data->signal = PREPARE_FOR_SHUTDOWN;
+
+ /* Sleep so user applications have time to respond */
+ g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1289,11 +1345,30 @@ static void
do_stop (CkManager *manager,
DBusGMethodInvocation *context)
{
- do_system_action (manager,
- context,
- PREFIX "/lib/ConsoleKit/scripts/ck-system-stop",
- CK_LOG_EVENT_SYSTEM_STOP,
- "Stop");
+ SystemActionData *data;
+
+ /* Emit the signal */
+ g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, TRUE);
+
+ /* Allocate and fill the data struct to pass to the idle cb */
+ data = g_new0 (SystemActionData, 1);
+ if (data == NULL) {
+ g_critical ("failed to allocate memory to perform shutdown\n");
+ g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, FALSE);
+ return;
+ }
+
+ data->manager = manager;
+ data->context = context;
+ data->command = PREFIX "/lib/ConsoleKit/scripts/ck-system-stop";
+ data->event_type = CK_LOG_EVENT_SYSTEM_STOP;
+ data->description = "Stop";
+ data->signal = PREPARE_FOR_SHUTDOWN;
+
+ /* Sleep so user applications have time to respond */
+ g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
gboolean
@@ -1486,11 +1561,30 @@ static void
do_suspend (CkManager *manager,
DBusGMethodInvocation *context)
{
- do_system_action (manager,
- context,
- PREFIX "/lib/ConsoleKit/scripts/ck-system-suspend",
- CK_LOG_EVENT_SYSTEM_SUSPEND,
- "Suspend");
+ SystemActionData *data;
+
+ /* Emit the signal */
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, TRUE);
+
+ /* Allocate and fill the data struct to pass to the idle cb */
+ data = g_new0 (SystemActionData, 1);
+ if (data == NULL) {
+ g_critical ("failed to allocate memory to perform suspend\n");
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ return;
+ }
+
+ data->manager = manager;
+ data->context = context;
+ data->command = PREFIX "/lib/ConsoleKit/scripts/ck-system-suspend";
+ data->event_type = CK_LOG_EVENT_SYSTEM_SUSPEND;
+ data->description = "Suspend";
+ data->signal = PREPARE_FOR_SLEEP;
+
+ /* Sleep so user applications have time to respond */
+ g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1572,11 +1666,30 @@ static void
do_hibernate (CkManager *manager,
DBusGMethodInvocation *context)
{
- do_system_action (manager,
- context,
- PREFIX "/lib/ConsoleKit/scripts/ck-system-hibernate",
- CK_LOG_EVENT_SYSTEM_HIBERNATE,
- "Hibernate");
+ SystemActionData *data;
+
+ /* Emit the signal */
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, TRUE);
+
+ /* Allocate and fill the data struct to pass to the idle cb */
+ data = g_new0 (SystemActionData, 1);
+ if (data == NULL) {
+ g_critical ("failed to allocate memory to perform suspend\n");
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ return;
+ }
+
+ data->manager = manager;
+ data->context = context;
+ data->command = PREFIX "/lib/ConsoleKit/scripts/ck-system-hibernate";
+ data->event_type = CK_LOG_EVENT_SYSTEM_HIBERNATE;
+ data->description = "Hibernate";
+ data->signal = PREPARE_FOR_SLEEP;
+
+ /* Sleep so user applications have time to respond */
+ g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1658,11 +1771,30 @@ static void
do_hybrid_sleep (CkManager *manager,
DBusGMethodInvocation *context)
{
- do_system_action (manager,
- context,
- PREFIX "/lib/ConsoleKit/scripts/ck-system-hybridsleep",
- CK_LOG_EVENT_SYSTEM_HIBERNATE,
- "Hybrid Sleep");
+ SystemActionData *data;
+
+ /* Emit the signal */
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, TRUE);
+
+ /* Allocate and fill the data struct to pass to the idle cb */
+ data = g_new0 (SystemActionData, 1);
+ if (data == NULL) {
+ g_critical ("failed to allocate memory to perform suspend\n");
+ g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ return;
+ }
+
+ data->manager = manager;
+ data->context = context;
+ data->command = PREFIX "/lib/ConsoleKit/scripts/ck-system-hybridsleep";
+ data->event_type = CK_LOG_EVENT_SYSTEM_HIBERNATE;
+ data->description = "Hybrid Sleep";
+ data->signal = PREPARE_FOR_SLEEP;
+
+ /* Sleep so user applications have time to respond */
+ g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -3043,6 +3175,26 @@ ck_manager_class_init (CkManagerClass *klass)
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE,
1, G_TYPE_BOOLEAN);
+ signals [PREPARE_FOR_SHUTDOWN] =
+ g_signal_new ("prepare-for-shutdown",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CkManagerClass, prepare_for_shutdown),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE,
+ 1, G_TYPE_BOOLEAN);
+ signals [PREPARE_FOR_SLEEP] =
+ g_signal_new ("prepare-for-sleep",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CkManagerClass, prepare_for_sleep),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE,
+ 1, G_TYPE_BOOLEAN);
dbus_g_object_type_install_info (CK_TYPE_MANAGER, &dbus_glib_ck_manager_object_info);
dbus_g_error_domain_register (CK_MANAGER_ERROR, NULL, CK_MANAGER_TYPE_ERROR);
@@ -3256,6 +3408,8 @@ ck_manager_init (CkManager *manager)
manager->priv->inhibit_manager = ck_inhibit_manager_get ();
+ manager->priv->system_action_idle_delay = 4 * 1000;
+
create_seats (manager);
}
diff --git a/src/ck-manager.h b/src/ck-manager.h
index 098d464..5bdc76e 100644
--- a/src/ck-manager.h
+++ b/src/ck-manager.h
@@ -54,6 +54,10 @@ typedef struct
const char *sid);
void (* system_idle_hint_changed) (CkManager *manager,
gboolean idle_hint);
+ void (* prepare_for_shutdown) (CkManager *manager,
+ gboolean active);
+ void (* prepare_for_sleep) (CkManager *manager,
+ gboolean active);
} CkManagerClass;
typedef enum
diff --git a/src/org.freedesktop.ConsoleKit.Manager.xml b/src/org.freedesktop.ConsoleKit.Manager.xml
index eb44d45..9b94120 100644
--- a/src/org.freedesktop.ConsoleKit.Manager.xml
+++ b/src/org.freedesktop.ConsoleKit.Manager.xml
@@ -603,5 +603,36 @@
</doc:description>
</doc:doc>
</signal>
+ <signal name="PrepareForShutdown">
+ <arg name="active" type="b">
+ <doc:doc>
+ <doc:summary>TRUE when the system is starting to halt.</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the system is halting (active = TRUE). If
+ successful there will not be a FALSE signal emitted since
+ the system will poweroff or reboot. It will emit a FALSE
+ signal if the shutdown operation failed.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
+ <signal name="PrepareForSleep">
+ <arg name="active" type="b">
+ <doc:doc>
+ <doc:summary>TRUE when starting to sleep.</doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>Emitted when the system is starting the sleep process.
+ It will emit with an active = FALSE when resuming from sleep
+ or if the sleep operation failed.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </signal>
</interface>
</node>
--
2.2.1

View File

@ -0,0 +1,206 @@
From f7fea0b26f2a18f920564b6df017f915b4c5712f Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 17 Nov 2014 12:43:39 +0300
Subject: [PATCH 06/12] Keep track of the idle callback
This way we can prevent the user applications from attempting to
perform multiple system events at the same time. The additional
attempts will fail.
---
src/ck-manager.c | 68 +++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 52 insertions(+), 16 deletions(-)
diff --git a/src/ck-manager.c b/src/ck-manager.c
index 0110d89..e1bf022 100644
--- a/src/ck-manager.c
+++ b/src/ck-manager.c
@@ -86,6 +86,9 @@ struct CkManagerPrivate
/* How long to delay after emitting the PREPARE_FOR_SHUTDOWN or
* PREPARE_FOR_SLEEP signal */
guint system_action_idle_delay;
+ /* The idle callback id so we can detect multiple attempts to
+ * perform a system action at the same time */
+ guint system_action_idle_id;
CkInhibitManager *inhibit_manager;
};
@@ -1239,7 +1242,7 @@ system_action_idle_cb(SystemActionData *data)
{
g_return_val_if_fail (data != NULL, FALSE);
- /* Perform the action */
+ /* Perform the action, it will handle the dbus_g_method_return */
do_system_action (data->manager,
data->context,
data->command,
@@ -1250,6 +1253,9 @@ system_action_idle_cb(SystemActionData *data)
* or the operation failed. Either way we can signal to the apps */
g_signal_emit (data->manager, signals [data->signal], 0, FALSE);
+ /* reset this since we'll return FALSE here and kill the cb */
+ data->manager->priv->system_action_idle_id = 0;
+
g_free (data);
return FALSE;
@@ -1261,6 +1267,13 @@ do_restart (CkManager *manager,
{
SystemActionData *data;
+ /* Don't allow multiple system actions at the same time */
+ if (manager->priv->system_action_idle_id != 0) {
+ g_error ("attempting to perform a system action while one is in progress");
+ dbus_g_method_return (context, FALSE);
+ return;
+ }
+
/* Emit the signal */
g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, TRUE);
@@ -1280,9 +1293,9 @@ do_restart (CkManager *manager,
data->signal = PREPARE_FOR_SHUTDOWN;
/* Sleep so user applications have time to respond */
- g_timeout_add (data->manager->priv->system_action_idle_delay,
- (GSourceFunc)system_action_idle_cb,
- data);
+ manager->priv->system_action_idle_id = g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1347,6 +1360,13 @@ do_stop (CkManager *manager,
{
SystemActionData *data;
+ /* Don't allow multiple system actions at the same time */
+ if (manager->priv->system_action_idle_id != 0) {
+ g_error ("attempting to perform a system action while one is in progress");
+ dbus_g_method_return (context, FALSE);
+ return;
+ }
+
/* Emit the signal */
g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, TRUE);
@@ -1355,6 +1375,7 @@ do_stop (CkManager *manager,
if (data == NULL) {
g_critical ("failed to allocate memory to perform shutdown\n");
g_signal_emit (manager, signals [PREPARE_FOR_SHUTDOWN], 0, FALSE);
+ dbus_g_method_return (context, FALSE);
return;
}
@@ -1366,9 +1387,9 @@ do_stop (CkManager *manager,
data->signal = PREPARE_FOR_SHUTDOWN;
/* Sleep so user applications have time to respond */
- g_timeout_add (data->manager->priv->system_action_idle_delay,
- (GSourceFunc)system_action_idle_cb,
- data);
+ manager->priv->system_action_idle_id = g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
gboolean
@@ -1563,6 +1584,13 @@ do_suspend (CkManager *manager,
{
SystemActionData *data;
+ /* Don't allow multiple system actions at the same time */
+ if (manager->priv->system_action_idle_id != 0) {
+ g_error ("attempting to perform a system action while one is in progress");
+ dbus_g_method_return (context, FALSE);
+ return;
+ }
+
/* Emit the signal */
g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, TRUE);
@@ -1571,6 +1599,7 @@ do_suspend (CkManager *manager,
if (data == NULL) {
g_critical ("failed to allocate memory to perform suspend\n");
g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ dbus_g_method_return (context, FALSE);
return;
}
@@ -1582,9 +1611,9 @@ do_suspend (CkManager *manager,
data->signal = PREPARE_FOR_SLEEP;
/* Sleep so user applications have time to respond */
- g_timeout_add (data->manager->priv->system_action_idle_delay,
- (GSourceFunc)system_action_idle_cb,
- data);
+ manager->priv->system_action_idle_id = g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1676,6 +1705,7 @@ do_hibernate (CkManager *manager,
if (data == NULL) {
g_critical ("failed to allocate memory to perform suspend\n");
g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ dbus_g_method_return (context, FALSE);
return;
}
@@ -1687,9 +1717,9 @@ do_hibernate (CkManager *manager,
data->signal = PREPARE_FOR_SLEEP;
/* Sleep so user applications have time to respond */
- g_timeout_add (data->manager->priv->system_action_idle_delay,
- (GSourceFunc)system_action_idle_cb,
- data);
+ manager->priv->system_action_idle_id = g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -1781,6 +1811,7 @@ do_hybrid_sleep (CkManager *manager,
if (data == NULL) {
g_critical ("failed to allocate memory to perform suspend\n");
g_signal_emit (manager, signals [PREPARE_FOR_SLEEP], 0, FALSE);
+ dbus_g_method_return (context, FALSE);
return;
}
@@ -1792,9 +1823,9 @@ do_hybrid_sleep (CkManager *manager,
data->signal = PREPARE_FOR_SLEEP;
/* Sleep so user applications have time to respond */
- g_timeout_add (data->manager->priv->system_action_idle_delay,
- (GSourceFunc)system_action_idle_cb,
- data);
+ manager->priv->system_action_idle_id = g_timeout_add (data->manager->priv->system_action_idle_delay,
+ (GSourceFunc)system_action_idle_cb,
+ data);
}
/*
@@ -3409,6 +3440,7 @@ ck_manager_init (CkManager *manager)
manager->priv->inhibit_manager = ck_inhibit_manager_get ();
manager->priv->system_action_idle_delay = 4 * 1000;
+ manager->priv->system_action_idle_id = 0;
create_seats (manager);
}
@@ -3440,6 +3472,10 @@ ck_manager_finalize (GObject *object)
g_object_unref (manager->priv->inhibit_manager);
}
+ if (manager->priv->system_action_idle_id != 0) {
+ g_source_remove (manager->priv->system_action_idle_id);
+ }
+
G_OBJECT_CLASS (ck_manager_parent_class)->finalize (object);
}
--
2.2.1

View File

@ -0,0 +1,225 @@
From 80f8dc8620b8932aa922c470b4aa2cd2fe7afe50 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@gnome.org>
Date: Thu, 27 Nov 2014 10:28:36 +0100
Subject: [PATCH 07/12] openbsd: cleanups and sync with ConsoleKit port
We never needed to use an external helper script with the original
ConsoleKit for ck-get-x11-*, so drop these.
Make sure we install the other tools and simplify the scripts in the
process.
---
src/ck-vt-monitor.c | 2 +-
tools/Makefile.am | 4 ++++
tools/openbsd/Makefile.am | 2 --
tools/openbsd/ck-get-x11-display-device | 41 ---------------------------------
tools/openbsd/ck-get-x11-server-pid | 17 --------------
tools/openbsd/ck-system-hibernate | 11 +--------
tools/openbsd/ck-system-hybridsleep | 1 -
tools/openbsd/ck-system-restart | 11 +--------
tools/openbsd/ck-system-stop | 17 +-------------
tools/openbsd/ck-system-suspend | 11 +--------
10 files changed, 9 insertions(+), 108 deletions(-)
delete mode 100755 tools/openbsd/ck-get-x11-display-device
delete mode 100755 tools/openbsd/ck-get-x11-server-pid
diff --git a/src/ck-vt-monitor.c b/src/ck-vt-monitor.c
index 2b7f28b..1041f79 100644
--- a/src/ck-vt-monitor.c
+++ b/src/ck-vt-monitor.c
@@ -408,7 +408,7 @@ static void
vt_add_watches (CkVtMonitor *vt_monitor)
{
#if defined (__sun) && !defined (HAVE_SYS_VT_H) || (defined(__OpenBSD__) && (!defined(__i386__) && !defined(__amd64__) && !defined(__powerpc__)))
- /* On OpenBSD, VT are only available on i386 and amd64 */
+ /* On OpenBSD, VT are only available on i386, amd64 and powerpc */
/* Best to do nothing if VT is not supported */
#elif defined (__sun) && defined (HAVE_SYS_VT_H)
/*
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 873f684..2948ad1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -14,6 +14,10 @@ if CK_COMPILE_FREEBSD
SUBDIRS += freebsd
endif
+if CK_COMPILE_OPENBSD
+SUBDIRS += openbsd
+endif
+
if CK_COMPILE_SOLARIS
SUBDIRS += solaris
endif
diff --git a/tools/openbsd/Makefile.am b/tools/openbsd/Makefile.am
index b06d00c..3fb3679 100644
--- a/tools/openbsd/Makefile.am
+++ b/tools/openbsd/Makefile.am
@@ -13,8 +13,6 @@ script_SCRIPTS = \
ck-system-suspend \
ck-system-hibernate \
ck-system-hybridsleep \
- ck-get-x11-display-device \
- ck-get-x11-server-pid \
$(NULL)
EXTRA_DIST = \
diff --git a/tools/openbsd/ck-get-x11-display-device b/tools/openbsd/ck-get-x11-display-device
deleted file mode 100755
index 7efc084..0000000
--- a/tools/openbsd/ck-get-x11-display-device
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-FSTAT="/usr/bin/fstat"
-GREP="/usr/bin/grep"
-AWK="/usr/bin/awk"
-SED="/usr/bin/sed"
-CAT="/bin/cat"
-
-dispnum=0
-if [ x"$1" = x"--display" ]; then
- if [ $# != 2 ]; then
- echo "usage: $0 [--display DISPLAY]"
- exit 1
- fi
- DISPLAY=$2
-fi
-if [ ! -z "${DISPLAY}" ]; then
- dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
-fi
-
-if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
- echo "ERROR: Failed to find X lock file for display ${dispnum}"
- exit 1
-fi
-pid=$(${CAT} "/tmp/.X${dispnum}-lock")
-
-device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${AWK} '{print $8}')
-
-if [ -z "${device}" ]; then
- echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
- exit 1
-fi
-
-ret=""
-for dev in ${device}; do
- if [ "${dev}" \> "${ret}" ]; then
- ret=${dev}
- fi
-done
-
-echo "/dev/${dev}"
diff --git a/tools/openbsd/ck-get-x11-server-pid b/tools/openbsd/ck-get-x11-server-pid
deleted file mode 100755
index 05c433e..0000000
--- a/tools/openbsd/ck-get-x11-server-pid
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-SED="/usr/bin/sed"
-CAT="/bin/cat"
-
-dispnum=0
-if [ ! -z "${DISPLAY}" ]; then
- dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
-fi
-
-if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
- echo "ERROR: Failed to find X lock file for display ${dispnum}"
- exit 1
-fi
-pid=$(${CAT} "/tmp/.X${dispnum}-lock")
-
-echo ${pid}
diff --git a/tools/openbsd/ck-system-hibernate b/tools/openbsd/ck-system-hibernate
index 2f35fe4..dd2568a 100644
--- a/tools/openbsd/ck-system-hibernate
+++ b/tools/openbsd/ck-system-hibernate
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/ZZZ" ] ; then
- /sbin/ZZZ
- exit $?
-elif [ -x "/usr/sbin/ZZZ" ] ; then
- /usr/sbin/ZZZ
- exit $?
-else
- exit 1
-fi
+/usr/sbin/ZZZ
diff --git a/tools/openbsd/ck-system-hybridsleep b/tools/openbsd/ck-system-hybridsleep
index 8405318..9dda927 100644
--- a/tools/openbsd/ck-system-hybridsleep
+++ b/tools/openbsd/ck-system-hybridsleep
@@ -2,4 +2,3 @@
# Not implemented
exit 1
-
diff --git a/tools/openbsd/ck-system-restart b/tools/openbsd/ck-system-restart
index 8e0664e..8272348 100755
--- a/tools/openbsd/ck-system-restart
+++ b/tools/openbsd/ck-system-restart
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -r now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -r now
- exit $?
-else
- exit 1
-fi
+/sbin/shutdown -r now
diff --git a/tools/openbsd/ck-system-stop b/tools/openbsd/ck-system-stop
index 7bdb13d..8ab51af 100755
--- a/tools/openbsd/ck-system-stop
+++ b/tools/openbsd/ck-system-stop
@@ -1,18 +1,3 @@
#!/bin/sh
-unsupported() {
- echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
- echo "No shutdown command found" >&2
- exit 1
-}
-
-#Try for common tools
-if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -hp now
- exit $?
-elif [ -x "/usr/sbin/shutdown" ] ; then
- /usr/sbin/shutdown -p now
- exit $?
-else
- unsupported
-fi
+/sbin/shutdown -hp now
diff --git a/tools/openbsd/ck-system-suspend b/tools/openbsd/ck-system-suspend
index 092165c..27304af 100644
--- a/tools/openbsd/ck-system-suspend
+++ b/tools/openbsd/ck-system-suspend
@@ -1,12 +1,3 @@
#!/bin/sh
-#Try for common tools
-if [ -x "/sbin/zzz" ] ; then
- /sbin/zzz
- exit $?
-elif [ -x "/usr/sbin/zzz" ] ; then
- /usr/sbin/zzz
- exit $?
-else
- exit 1
-fi
+/usr/sbin/zzz
--
2.2.1

View File

@ -0,0 +1,47 @@
From 7207144ad6ce57c600a6e277c1bd3169ef627504 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 17 Nov 2014 08:44:43 +0300
Subject: [PATCH 08/12] Fix pam-foreground-compat install
The pam-foreground-compat.ck script should be installed without
requring udev.
---
tools/Makefile.am | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 2948ad1..774b4ed 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -166,20 +166,21 @@ udev_acl_CFLAGS = \
$(AM_CFLAGS) \
$(NULL)
+install-exec-hook:
+ mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d
+ mkdir -p $(DESTDIR)$(UDEVDIR)
+ ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck
+ ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(UDEVDIR)/udev-acl
+endif
+
scriptdir = $(prefix)/lib/ConsoleKit/scripts
script_SCRIPTS = \
pam-foreground-compat.ck \
$(NULL)
-
-install-exec-hook:
- mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d
+install-data-hook:
mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d
- mkdir -p $(DESTDIR)$(UDEVDIR)
- ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck
- ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(UDEVDIR)/udev-acl
ln -sf $(prefix)/lib/ConsoleKit/scripts/pam-foreground-compat.ck $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/pam-foreground-compat.ck
-endif
EXTRA_DIST = \
$(script_SCRIPTS) \
--
2.2.1

View File

@ -0,0 +1,32 @@
From 40137c006c341542fec8be139b3acea78afb584e Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Sat, 6 Dec 2014 20:16:32 +0300
Subject: [PATCH 09/12] Revert "Fix crash on logout/login via SunRay"
This reverts commit 417e387750920b9e092705863a863e71a77ea431.
Causes a regression with polkit authorizations. See:
https://github.com/ConsoleKit2/ConsoleKit2/issues/16
https://github.com/ConsoleKit2/ConsoleKit2/issues/12
---
src/ck-seat.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/ck-seat.c b/src/ck-seat.c
index 7f79fea..6e6800f 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -514,9 +514,7 @@ change_active_session (CkSeat *seat,
* must be sent when the database dump is finished it is
* important that the '-full' signalled is emitted first. */
- if (CK_IS_SESSION (old_session)) {
- g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED_FULL], 0, old_session, session);
- }
+ g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED_FULL], 0, old_session, session);
g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid);
if (old_session != NULL) {
--
2.2.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
From 80543593f10b28531c7d7207c82f64dd8ea78590 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Wed, 10 Dec 2014 19:36:56 +0300
Subject: [PATCH 11/12] Fix for GLib-CRITICAL: Source ID was not found
On remote ck session, there was a warning generated during log out.
This patch should fix that warning as well as add a couple debug
lines to help future troubleshooting. Thanks to hhoffstaette for
helping to troubleshoot this issue. For details see:
https://github.com/ConsoleKit2/ConsoleKit2/pull/15
---
src/ck-tty-idle-monitor.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ck-tty-idle-monitor.c b/src/ck-tty-idle-monitor.c
index 2aba92a..2b41917 100644
--- a/src/ck-tty-idle-monitor.c
+++ b/src/ck-tty-idle-monitor.c
@@ -169,6 +169,7 @@ ck_tty_idle_monitor_get_property (GObject *object,
static void
remove_idle_hint_timeout (CkTtyIdleMonitor *tty_idle_monitor)
{
+ g_debug ("remove_idle_hint_timeout: checking timeout_id %d", tty_idle_monitor->priv->timeout_id);
if (tty_idle_monitor->priv->timeout_id > 0) {
g_source_remove (tty_idle_monitor->priv->timeout_id);
tty_idle_monitor->priv->timeout_id = 0;
@@ -225,6 +226,9 @@ check_tty_idle (CkTtyIdleMonitor *monitor)
time_t idletime;
time_t last_access;
+ g_debug ("check_tty_idle: setting timeout_id %d to 0", monitor->priv->timeout_id);
+ monitor->priv->timeout_id = 0;
+
if (monitor->priv->device == NULL) {
return FALSE;
}
@@ -246,8 +250,6 @@ check_tty_idle (CkTtyIdleMonitor *monitor)
tty_idle_monitor_set_idle_hint_internal (monitor, is_idle);
- monitor->priv->timeout_id = 0;
-
if (is_idle) {
if (! monitor_add_watch (monitor)) {
/* if we can't add a watch just add a new timer */
@@ -275,6 +277,7 @@ static void
schedule_tty_check (CkTtyIdleMonitor *monitor,
guint seconds)
{
+ g_debug ("schedule_tty_check: timeout_id %d", monitor->priv->timeout_id);
if (monitor->priv->timeout_id == 0) {
#if GLIB_CHECK_VERSION(2,14,0)
monitor->priv->timeout_id = g_timeout_add_seconds (seconds,
@@ -285,6 +288,7 @@ schedule_tty_check (CkTtyIdleMonitor *monitor,
(GSourceFunc)check_tty_idle,
monitor);
#endif
+ g_debug ("schedule_tty_check: timeout_id %d", monitor->priv->timeout_id);
}
}
--
2.2.1

View File

@ -0,0 +1,88 @@
From e4bc312cc5a5363ccf887475d187e5fbc07e0ad2 Mon Sep 17 00:00:00 2001
From: Robby Workman <rworkman@slackware.com>
Date: Thu, 11 Dec 2014 02:09:40 -0600
Subject: [PATCH 12/12] Fixup a couple of missed hardcoded /var/run/ usages
---
configure.ac | 1 +
src/main.c | 2 +-
tools/pam-foreground-compat.ck | 17 -----------------
tools/pam-foreground-compat.ck.in | 17 +++++++++++++++++
4 files changed, 19 insertions(+), 18 deletions(-)
delete mode 100755 tools/pam-foreground-compat.ck
create mode 100755 tools/pam-foreground-compat.ck.in
diff --git a/configure.ac b/configure.ac
index dd1f5bb..ff18e97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -489,6 +489,7 @@ Makefile
src/Makefile
tools/70-udev-acl.rules
tools/Makefile
+tools/pam-foreground-compat.ck
tools/linux/Makefile
tools/freebsd/Makefile
tools/openbsd/Makefile
diff --git a/src/main.c b/src/main.c
index 3137bf9..99150ee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -150,7 +150,7 @@ delete_pid (void)
unlink (CONSOLE_KIT_PID_FILE);
}
-#define CONSOLE_TAGS_DIR "/var/run/console"
+#define CONSOLE_TAGS_DIR RUNDIR "/console"
static void
delete_console_tags (void)
diff --git a/tools/pam-foreground-compat.ck b/tools/pam-foreground-compat.ck
deleted file mode 100755
index ce221c9..0000000
--- a/tools/pam-foreground-compat.ck
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-TAGDIR=/var/run/console
-
-[ -n "$CK_SESSION_USER_UID" ] || exit 1
-[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
-
-TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
-
-if [ "$1" = "session_added" ]; then
- mkdir -p "$TAGDIR"
- echo "$CK_SESSION_ID" >> "$TAGFILE"
-fi
-
-if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
- sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
- [ -s "$TAGFILE" ] || rm -f "$TAGFILE"
-fi
diff --git a/tools/pam-foreground-compat.ck.in b/tools/pam-foreground-compat.ck.in
new file mode 100755
index 0000000..67ca844
--- /dev/null
+++ b/tools/pam-foreground-compat.ck.in
@@ -0,0 +1,17 @@
+#!/bin/sh
+TAGDIR=@RUNDIR@/console
+
+[ -n "$CK_SESSION_USER_UID" ] || exit 1
+[ "$CK_SESSION_IS_LOCAL" = "true" ] || exit 0
+
+TAGFILE="$TAGDIR/`getent passwd $CK_SESSION_USER_UID | cut -f 1 -d:`"
+
+if [ "$1" = "session_added" ]; then
+ mkdir -p "$TAGDIR"
+ echo "$CK_SESSION_ID" >> "$TAGFILE"
+fi
+
+if [ "$1" = "session_removed" ] && [ -e "$TAGFILE" ]; then
+ sed -i "\%^$CK_SESSION_ID\$%d" "$TAGFILE"
+ [ -s "$TAGFILE" ] || rm -f "$TAGFILE"
+fi
--
2.2.1

View File

@ -1,12 +1,12 @@
--- pam-ck-connector/pam-ck-connector.c.orig 2015-05-14 06:36:12.217472340 +0200
+++ pam-ck-connector/pam-ck-connector.c 2015-05-14 06:37:03.465067270 +0200
--- a/pam-ck-connector/pam-ck-connector.c.orig 2015-05-14 06:36:12.217472340 +0200
+++ b/pam-ck-connector/pam-ck-connector.c 2015-05-14 06:37:03.465067270 +0200
@@ -197,7 +197,8 @@ _util_name_to_uid (const char *username,
bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
if (bufsize == -1) {
- return res;
+ /* musl returns -1, so that use a considerable buffer size */
+ bufsize = BUFSIZ;
+ /* musl returns -1, so that use a considerable buffer size */
+ bufsize = BUFSIZ;
}
buf = calloc (sizeof (char), bufsize);
rc = getpwnam_r (username, &pwd, buf, bufsize, &pwdp);

View File

@ -1,21 +1,22 @@
# Template file for 'ConsoleKit2'
pkgname=ConsoleKit2
version=0.9.3
revision=1
version=0.9.2
revision=6
patch_args="-Np1"
build_pie=yes
build_style=gnu-configure
configure_args="ac_cv_file__sys_class_tty_tty0_active=yes
--with-rundir=/run --enable-udev-acl --enable-pam-module
--with-pam-module-dir=/usr/lib/security"
hostmakedepends="automake libtool pkg-config gettext-devel glib-devel"
makedepends="acl-devel libudev-devel polkit-devel libglib-devel libX11-devel pam-devel"
--with-pam-module-dir=/usr/lib/security --sbindir=/usr/bin"
hostmakedepends="automake libtool pkg-config gettext-devel glib-devel dbus-glib-devel"
makedepends="acl-devel libudev-devel polkit-devel dbus-glib-devel glib-devel libX11-devel pam-devel"
depends="dbus"
short_desc="A framework for defining and tracking users, login sessions, and seats"
maintainer="Enno Boland <eb@s01.de>"
homepage="http://consolekit2.github.io/ConsoleKit2/"
license="GPL-2"
distfiles="https://github.com/ConsoleKit2/ConsoleKit2/releases/download/${version}/ConsoleKit2-${version}.tar.bz2"
checksum=e8755fd12130ab5c2efe50d0e0314e748e70502ccc42912490488366f7f39e52
checksum=102aa07e0960e56740e235bba06a546c8e0e88f47546ef252ecda917935af41f
provides="ConsoleKit-${version}_${revision}"
replaces="ConsoleKit>=0"