summaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorkwm <kwm@df743ca5-7f9a-e211-a948-0013205c9059>2011-02-23 03:17:47 +0800
committerkwm <kwm@df743ca5-7f9a-e211-a948-0013205c9059>2011-02-23 03:17:47 +0800
commit72b9440cd4449b64d9ff697341d6fd82a811de32 (patch)
treec81e17f308889d85b5cb113aef01cb7984072e1d /sysutils
parent3f7c35ea164ccce1ea5736199d7c374ee75f2bb7 (diff)
downloadmarcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar.gz
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar.bz2
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar.lz
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar.xz
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.tar.zst
marcuscom-ports-72b9440cd4449b64d9ff697341d6fd82a811de32.zip
Update to 0.4.4.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@15271 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/consolekit/Makefile41
-rw-r--r--sysutils/consolekit/distinfo2
-rw-r--r--sysutils/consolekit/files/ck-get-x11-display-device41
-rw-r--r--sysutils/consolekit/files/ck-get-x11-server-pid17
-rw-r--r--sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c198
-rw-r--r--sysutils/consolekit/files/patch-src_ck-sysdeps-unix.c18
-rw-r--r--sysutils/consolekit/files/patch-src_main.c33
-rw-r--r--sysutils/consolekit/files/patch-src_test-vt-monitor.c33
-rw-r--r--sysutils/consolekit/files/patch-tools_Makefile.in77
-rw-r--r--sysutils/consolekit/files/patch-tools_ck-collect-session-info.c75
-rw-r--r--sysutils/consolekit/files/patch-tools_ck-log-system-start.c60
-rw-r--r--sysutils/consolekit/pkg-descr6
-rw-r--r--sysutils/consolekit/pkg-plist43
13 files changed, 644 insertions, 0 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
new file mode 100644
index 000000000..1f0628755
--- /dev/null
+++ b/sysutils/consolekit/Makefile
@@ -0,0 +1,41 @@
+# New ports collection makefile for: ConsoleKit
+# Date Created: 26 Aug 2006
+# Whom: Florent Thoumie <flz@FreeBSD.org>
+#
+# $FreeBSD: ports/sysutils/consolekit/Makefile,v 1.18 2010/11/26 23:37:11 marcus Exp $
+# $MCom: ports/sysutils/consolekit/Makefile,v 1.25 2010/10/23 10:12:30 kwm Exp $
+
+PORTNAME= consolekit
+PORTVERSION= 0.4.4
+CATEGORIES= sysutils gnome
+MASTER_SITES= http://www.freedesktop.org/software/ConsoleKit/dist/
+DISTFILES= ConsoleKit-${PORTVERSION}${EXTRACT_SUFX}
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= Framework for defining and tracking users
+
+LIB_DEPENDS= dbus-glib-1.2:${PORTSDIR}/devel/dbus-glib \
+ polkit-gobject-1.0:${PORTSDIR}/sysutils/polkit
+
+WRKSRC= ${WRKDIR}/ConsoleKit-${PORTVERSION}
+USE_BZIP2= yes
+USE_GETTEXT= yes
+USE_XORG= x11
+USE_GNOME= gnomehack
+USE_GMAKE= yes
+GNU_CONFIGURE= yes
+USE_LDCONFIG= yes
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+CONFIGURE_ARGS= --with-pid-file=/var/run/${PORTNAME}.pid \
+ --localstatedir=/var
+
+post-install:
+ ${INSTALL_SCRIPT} ${FILESDIR}/ck-get-x11-display-device \
+ ${PREFIX}/libexec/ck-get-x11-display-device
+ ${INSTALL_SCRIPT} ${FILESDIR}/ck-get-x11-server-pid \
+ ${PREFIX}/libexec/ck-get-x11-server-pid
+ ${MKDIR} /var/log/ConsoleKit
+ ${TOUCH} /var/log/ConsoleKit/history
+
+.include <bsd.port.mk>
diff --git a/sysutils/consolekit/distinfo b/sysutils/consolekit/distinfo
new file mode 100644
index 000000000..8bbc30d63
--- /dev/null
+++ b/sysutils/consolekit/distinfo
@@ -0,0 +1,2 @@
+SHA256 (ConsoleKit-0.4.4.tar.bz2) = f0c00969fb6fe7d628071f0f43ac0d411982a5e798d7dc31747caa772c9716ae
+SIZE (ConsoleKit-0.4.4.tar.bz2) = 424699
diff --git a/sysutils/consolekit/files/ck-get-x11-display-device b/sysutils/consolekit/files/ck-get-x11-display-device
new file mode 100644
index 000000000..7efc08471
--- /dev/null
+++ b/sysutils/consolekit/files/ck-get-x11-display-device
@@ -0,0 +1,41 @@
+#!/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/sysutils/consolekit/files/ck-get-x11-server-pid b/sysutils/consolekit/files/ck-get-x11-server-pid
new file mode 100644
index 000000000..05c433e01
--- /dev/null
+++ b/sysutils/consolekit/files/ck-get-x11-server-pid
@@ -0,0 +1,17 @@
+#!/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/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c b/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c
new file mode 100644
index 000000000..d57649345
--- /dev/null
+++ b/sysutils/consolekit/files/patch-src_ck-sysdeps-freebsd.c
@@ -0,0 +1,198 @@
+--- src/ck-sysdeps-freebsd.c.orig 2008-04-03 20:36:21.000000000 -0400
++++ src/ck-sysdeps-freebsd.c 2009-04-18 18:04:39.000000000 -0400
+@@ -27,6 +27,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <errno.h>
++#include <glob.h>
+ #include <paths.h>
+ #include <ttyent.h>
+ #include <kvm.h>
+@@ -202,7 +203,6 @@ ck_process_stat_new_for_unix_pid (pid_t
+ GError **error)
+ {
+ gboolean res;
+- GError *local_error;
+ CkProcessStat *proc;
+
+ g_return_val_if_fail (pid > 1, FALSE);
+@@ -217,7 +217,6 @@ ck_process_stat_new_for_unix_pid (pid_t
+ if (res) {
+ *stat = proc;
+ } else {
+- g_propagate_error (error, local_error);
+ *stat = NULL;
+ }
+
+@@ -233,24 +232,28 @@ ck_process_stat_free (CkProcessStat *sta
+ GHashTable *
+ ck_unix_pid_get_env_hash (pid_t pid)
+ {
+- GHashTable *hash;
++ GHashTable *hash = NULL;
+ char **penv;
++ char errbuf[_POSIX2_LINE_MAX];
+ kvm_t *kd;
+ struct kinfo_proc p;
+ int i;
+
+- kd = kvm_openfiles (_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
++ kd = kvm_openfiles (_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, errbuf);
+ if (kd == NULL) {
++ g_warning ("kvm_openfiles failed: %s", errbuf);
+ return NULL;
+ }
+
+ if (! get_kinfo_proc (pid, &p)) {
+- return NULL;
++ g_warning ("get_kinfo_proc failed: %s", g_strerror (errno));
++ goto fail;
+ }
+
+ penv = kvm_getenvv (kd, &p, 0);
+ if (penv == NULL) {
+- return NULL;
++ g_warning ("kvm_getenvv failed: %s", kvm_geterr (kd));
++ goto fail;
+ }
+
+ hash = g_hash_table_new_full (g_str_hash,
+@@ -270,6 +273,7 @@ ck_unix_pid_get_env_hash (pid_t pid)
+ }
+ }
+
++fail:
+ kvm_close (kd);
+
+ return hash;
+@@ -280,7 +284,7 @@ ck_unix_pid_get_env (pid_t pid,
+ const char *var)
+ {
+ GHashTable *hash;
+- char *val;
++ char *val = NULL;
+
+ /*
+ * Would probably be more efficient to just loop through the
+@@ -288,6 +292,8 @@ ck_unix_pid_get_env (pid_t pid,
+ * table, but this works for now.
+ */
+ hash = ck_unix_pid_get_env_hash (pid);
++ if (hash == NULL)
++ return val;
+ val = g_strdup (g_hash_table_lookup (hash, var));
+ g_hash_table_destroy (hash);
+
+@@ -327,38 +333,38 @@ gboolean
+ ck_get_max_num_consoles (guint *num)
+ {
+ int max_consoles;
+- int res;
+- gboolean ret;
+- struct ttyent *t;
++ int i;
++ glob_t g;
+
+- ret = FALSE;
+ max_consoles = 0;
+
+- res = setttyent ();
+- if (res == 0) {
+- goto done;
+- }
++ g.gl_offs = 0;
++ glob ("/dev/ttyv*", GLOB_DOOFFS | GLOB_NOSORT, NULL, &g);
++ for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
++ struct stat sb;
++ char *cdev;
+
+- while ((t = getttyent ()) != NULL) {
+- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
++ cdev = g.gl_pathv[i];
++ if (stat (cdev, &sb) > -1 && S_ISCHR (sb.st_mode)) {
+ max_consoles++;
++ } else {
++ break;
++ }
+ }
+
+- /* Increment one more so that all consoles are properly counted
++ globfree (&g);
++
++ /*
++ * Increment one more so that all consoles are properly counted
+ * this is arguable a bug in vt_add_watches().
+ */
+ max_consoles++;
+
+- ret = TRUE;
+-
+- endttyent ();
+-
+-done:
+ if (num != NULL) {
+ *num = max_consoles;
+ }
+
+- return ret;
++ return TRUE;
+ }
+
+ char *
+@@ -369,7 +375,12 @@ ck_get_console_device_for_num (guint num
+ /* The device number is always one less than the VT number. */
+ num--;
+
+- device = g_strdup_printf ("/dev/ttyv%u", num);
++ if (num < 10)
++ device = g_strdup_printf ("/dev/ttyv%i", num);
++ else if (num < 32)
++ device = g_strdup_printf ("/dev/ttyv%c", num - 10 + 'a');
++ else
++ device = NULL;
+
+ return device;
+ }
+@@ -379,6 +390,7 @@ ck_get_console_num_from_device (const ch
+ guint *num)
+ {
+ guint n;
++ char c;
+ gboolean ret;
+
+ n = 0;
+@@ -388,7 +400,11 @@ ck_get_console_num_from_device (const ch
+ return FALSE;
+ }
+
+- if (sscanf (device, "/dev/ttyv%u", &n) == 1) {
++ if (sscanf (device, "/dev/ttyv%c", &c) == 1) {
++ if (c < 58)
++ n = c - 48;
++ else
++ n = c - 'a' + 10;
+ /* The VT number is always one more than the device number. */
+ n++;
+ ret = TRUE;
+@@ -408,6 +424,7 @@ ck_get_active_console_num (int consol
+ gboolean ret;
+ int res;
+ int active;
++ char ttyn;
+
+ g_assert (console_fd != -1);
+
+@@ -420,7 +437,12 @@ ck_get_active_console_num (int consol
+ goto out;
+ }
+
+- g_debug ("Active VT is: %d (ttyv%d)", active, active - 1);
++ if (active - 1 < 10)
++ ttyn = active - 1 + '0';
++ else
++ ttyn = active - 11 + 'a';
++
++ g_debug ("Active VT is: %d (ttyv%c)", active, ttyn);
+ ret = TRUE;
+
+ out:
diff --git a/sysutils/consolekit/files/patch-src_ck-sysdeps-unix.c b/sysutils/consolekit/files/patch-src_ck-sysdeps-unix.c
new file mode 100644
index 000000000..e256e9f36
--- /dev/null
+++ b/sysutils/consolekit/files/patch-src_ck-sysdeps-unix.c
@@ -0,0 +1,18 @@
+--- src/ck-sysdeps-unix.c.orig 2008-02-06 22:59:55.000000000 -0500
++++ src/ck-sysdeps-unix.c 2008-02-06 22:52:34.000000000 -0500
+@@ -172,6 +172,15 @@ ck_get_a_console_fd (void)
+
+ fd = -1;
+
++#ifdef __FreeBSD__
++ /* On FreeBSD, try /dev/consolectl first as this will survive
++ * /etc/ttys initialization. */
++ fd = open_a_console ("/dev/consolectl");
++ if (fd >= 0) {
++ goto done;
++ }
++#endif
++
+ #ifdef __sun
+ /* On Solaris, first try Sun VT device. */
+ fd = open_a_console ("/dev/vt/active");
diff --git a/sysutils/consolekit/files/patch-src_main.c b/sysutils/consolekit/files/patch-src_main.c
new file mode 100644
index 000000000..a791db0f9
--- /dev/null
+++ b/sysutils/consolekit/files/patch-src_main.c
@@ -0,0 +1,33 @@
+--- src/main.c.orig 2007-11-08 15:05:55.000000000 -0500
++++ src/main.c 2007-11-08 15:07:39.000000000 -0500
+@@ -226,6 +226,21 @@ sigusr1_handler (int sig)
+ }
+
+ static void
++setup_termination_signals (void)
++{
++ struct sigaction sa;
++
++ sa.sa_handler = SIG_DFL;
++ sigemptyset (&sa.sa_mask);
++ sa.sa_flags = 0;
++
++ sigaction (SIGTERM, &sa, NULL);
++ sigaction (SIGQUIT, &sa, NULL);
++ sigaction (SIGINT, &sa, NULL);
++ sigaction (SIGHUP, &sa, NULL);
++}
++
++static void
+ setup_debug_log_signals (void)
+ {
+ struct sigaction sa;
+@@ -300,6 +315,8 @@ main (int argc,
+
+ setup_debug_log (debug);
+
++ setup_termination_signals ();
++
+ connection = get_system_bus ();
+ if (connection == NULL) {
+ goto out;
diff --git a/sysutils/consolekit/files/patch-src_test-vt-monitor.c b/sysutils/consolekit/files/patch-src_test-vt-monitor.c
new file mode 100644
index 000000000..6fb9740f5
--- /dev/null
+++ b/sysutils/consolekit/files/patch-src_test-vt-monitor.c
@@ -0,0 +1,33 @@
+--- src/test-vt-monitor.c.orig 2007-08-17 13:08:55.000000000 -0400
++++ src/test-vt-monitor.c 2007-11-08 15:11:37.000000000 -0500
+@@ -31,6 +31,7 @@
+ #include <pwd.h>
+ #include <string.h>
+ #include <errno.h>
++#include <signal.h>
+
+ #include <locale.h>
+
+@@ -55,12 +56,22 @@ main (int argc, char **argv)
+ GError *error;
+ guint num;
+ gboolean res;
++ struct sigaction sa;
+
+ if (! g_thread_supported ()) {
+ g_thread_init (NULL);
+ }
+ g_type_init ();
+
++ sa.sa_handler = SIG_DFL;
++ sigemptyset (&sa.sa_mask);
++ sa.sa_flags = 0;
++
++ sigaction (SIGINT, &sa, NULL);
++ sigaction (SIGTERM, &sa, NULL);
++ sigaction (SIGQUIT, &sa, NULL);
++ sigaction (SIGHUP, &sa, NULL);
++
+ if (! ck_is_root_user ()) {
+ g_warning ("Must be run as root");
+ exit (1);
diff --git a/sysutils/consolekit/files/patch-tools_Makefile.in b/sysutils/consolekit/files/patch-tools_Makefile.in
new file mode 100644
index 000000000..ed58bbb7a
--- /dev/null
+++ b/sysutils/consolekit/files/patch-tools_Makefile.in
@@ -0,0 +1,77 @@
+--- tools/Makefile.in.orig 2010-10-23 11:29:43.000000000 +0200
++++ tools/Makefile.in 2010-10-23 11:32:41.000000000 +0200
+@@ -43,8 +43,7 @@ sbin_PROGRAMS = ck-log-system-start$(EXE
+ ck-log-system-restart$(EXEEXT) ck-log-system-stop$(EXEEXT) \
+ $(am__EXEEXT_1)
+ libexec_PROGRAMS = ck-collect-session-info$(EXEEXT) \
+- ck-get-x11-server-pid$(EXEEXT) \
+- ck-get-x11-display-device$(EXEEXT) $(am__EXEEXT_1)
++ $(am__EXEEXT_1)
+ subdir = tools
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -71,17 +70,6 @@ ck_collect_session_info_DEPENDENCIES = $
+ AM_V_lt = $(am__v_lt_$(V))
+ am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+ am__v_lt_0 = --silent
+-am_ck_get_x11_display_device_OBJECTS = \
+- ck-get-x11-display-device.$(OBJEXT) $(am__objects_1)
+-ck_get_x11_display_device_OBJECTS = \
+- $(am_ck_get_x11_display_device_OBJECTS)
+-ck_get_x11_display_device_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+- $(top_builddir)/src/libck.la $(am__DEPENDENCIES_1)
+-am_ck_get_x11_server_pid_OBJECTS = ck-get-x11-server-pid.$(OBJEXT) \
+- $(am__objects_1)
+-ck_get_x11_server_pid_OBJECTS = $(am_ck_get_x11_server_pid_OBJECTS)
+-ck_get_x11_server_pid_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+- $(top_builddir)/src/libck.la $(am__DEPENDENCIES_1)
+ am_ck_history_OBJECTS = ck-history.$(OBJEXT) $(am__objects_1)
+ ck_history_OBJECTS = $(am_ck_history_OBJECTS)
+ ck_history_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+@@ -441,24 +429,6 @@ ck_collect_session_info_LDADD = \
+ $(top_builddir)/src/libck.la \
+ $(NULL)
+
+-ck_get_x11_server_pid_SOURCES = \
+- ck-get-x11-server-pid.c \
+- $(NULL)
+-
+-ck_get_x11_server_pid_LDADD = \
+- $(TOOLS_LIBS) \
+- $(top_builddir)/src/libck.la \
+- $(NULL)
+-
+-ck_get_x11_display_device_SOURCES = \
+- ck-get-x11-display-device.c \
+- $(NULL)
+-
+-ck_get_x11_display_device_LDADD = \
+- $(TOOLS_LIBS) \
+- $(top_builddir)/src/libck.la \
+- $(NULL)
+-
+ EXTRA_DIST = \
+ $(NULL)
+
+@@ -632,12 +602,6 @@ clean-sbinPROGRAMS:
+ ck-collect-session-info$(EXEEXT): $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_DEPENDENCIES)
+ @rm -f ck-collect-session-info$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_LDADD) $(LIBS)
+-ck-get-x11-display-device$(EXEEXT): $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_DEPENDENCIES)
+- @rm -f ck-get-x11-display-device$(EXEEXT)
+- $(AM_V_CCLD)$(LINK) $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_LDADD) $(LIBS)
+-ck-get-x11-server-pid$(EXEEXT): $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_DEPENDENCIES)
+- @rm -f ck-get-x11-server-pid$(EXEEXT)
+- $(AM_V_CCLD)$(LINK) $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_LDADD) $(LIBS)
+ ck-history$(EXEEXT): $(ck_history_OBJECTS) $(ck_history_DEPENDENCIES)
+ @rm -f ck-history$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(ck_history_OBJECTS) $(ck_history_LDADD) $(LIBS)
+@@ -664,8 +628,6 @@ distclean-compile:
+ -rm -f *.tab.c
+
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-collect-session-info.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-display-device.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-server-pid.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-history.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-launch-session.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-log-system-restart.Po@am__quote@
diff --git a/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c b/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c
new file mode 100644
index 000000000..36714d0c5
--- /dev/null
+++ b/sysutils/consolekit/files/patch-tools_ck-collect-session-info.c
@@ -0,0 +1,75 @@
+--- tools/ck-collect-session-info.c.orig 2009-04-29 15:07:29.000000000 -0400
++++ tools/ck-collect-session-info.c 2010-07-12 23:55:13.000000000 -0400
+@@ -226,6 +226,12 @@ fill_x11_info (SessionInfo *si)
+ gboolean res;
+ CkProcessStat *xorg_stat;
+ GError *error;
++ char *err;
++ char *out;
++ int status;
++ int i;
++ char *argv[4];
++ GPtrArray *env;
+
+ /* assume this is true then check it */
+ si->x11_display = ck_unix_pid_get_env (si->pid, "DISPLAY");
+@@ -272,6 +278,52 @@ fill_x11_info (SessionInfo *si)
+ }
+
+ si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
++ if (g_strcmp0 (si->x11_display_device, si->display_device) != 0) {
++ goto gotit;
++ }
++
++ g_free (si->x11_display_device);
++
++ /* get the applicable environment */
++ env = get_filtered_environment (si->pid);
++
++ argv[0] = LIBEXECDIR "/ck-get-x11-display-device";
++ argv[1] = NULL;
++
++ error = NULL;
++ out = NULL;
++ err = NULL;
++ status = -1;
++ res = g_spawn_sync (NULL,
++ argv,
++ (char **)env->pdata,
++ 0,
++ (GSpawnChildSetupFunc)setuid_child_setup_func,
++ si,
++ &out,
++ &err,
++ &status,
++ &error);
++ for (i = 0; i < env->len; i++) {
++ g_free (g_ptr_array_index (env, i));
++ }
++ g_ptr_array_free (env, TRUE);
++
++ if (error != NULL) {
++ g_warning ("Unable to get display device for x11 server: %s", error->message);
++ g_error_free (error);
++ }
++
++ if (status == 0) {
++ if (res && out != NULL) {
++ si->x11_display_device = g_strstrip (out);
++ goto gotit;
++ }
++ }
++
++ si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
++
++gotit:
+ ck_process_stat_free (xorg_stat);
+
+ si->is_local = TRUE;
+@@ -410,5 +462,5 @@ main (int argc,
+
+ ret = collect_session_info (user_id, process_id);
+
+- return ret != TRUE;
++ return ret != TRUE;
+ }
diff --git a/sysutils/consolekit/files/patch-tools_ck-log-system-start.c b/sysutils/consolekit/files/patch-tools_ck-log-system-start.c
new file mode 100644
index 000000000..0e125ef26
--- /dev/null
+++ b/sysutils/consolekit/files/patch-tools_ck-log-system-start.c
@@ -0,0 +1,60 @@
+--- tools/ck-log-system-start.c.orig 2009-09-14 20:08:10.000000000 -0400
++++ tools/ck-log-system-start.c 2009-09-26 01:35:37.000000000 -0400
+@@ -26,6 +26,9 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#ifdef __FreeBSD__
++#include <kenv.h>
++#endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/utsname.h>
+@@ -41,7 +44,9 @@
+
+ #define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history"
+
++#ifdef __linux__
+ #define LINUX_KERNEL_CMDLINE "/proc/cmdline"
++#endif
+
+ /* Adapted from auditd auditd-event.c */
+ static gboolean
+@@ -162,6 +167,7 @@ write_log_for_event (CkLogEvent *event)
+ static char *
+ get_boot_arguments (void)
+ {
++#if defined(__linux__)
+ char *contents;
+ gboolean res;
+
+@@ -178,6 +184,29 @@ get_boot_arguments (void)
+ }
+
+ return contents;
++#elif defined(__FreeBSD__)
++ char kern_name[1024], root[1024], mopts[1024];
++ char *options;
++
++ options = NULL;
++ if (kenv(KENV_GET, "kernelname", kern_name, sizeof (kern_name)) == -1) {
++ return options;
++ }
++
++ if (kenv(KENV_GET, "vfs.root.mountfrom.options", mopts, sizeof (mopts)) == -1) {
++ g_strlcpy (mopts, "ro", sizeof (mopts));
++ }
++
++ if (kenv(KENV_GET, "vfs.root.mountfrom", root, sizeof (root)) == -1) {
++ g_strlcpy (root, "/", sizeof (root));
++ }
++
++ options = g_strdup_printf ("%s %s root=%s", mopts, kern_name, root);
++
++ return options;
++#else
++ return NULL;
++#endif
+ }
+
+ int
diff --git a/sysutils/consolekit/pkg-descr b/sysutils/consolekit/pkg-descr
new file mode 100644
index 000000000..db13002ab
--- /dev/null
+++ b/sysutils/consolekit/pkg-descr
@@ -0,0 +1,6 @@
+ConsoleKit is a framework for defining and tracking users, login
+sessions, and seats. The primary motivations for this framework are to
+facilitate fast-user-switching and multi-seat capabilities, and to
+enable more sophisticated policy decisions for desktop sessions.
+
+WWW: http://www.freedesktop.org/wiki/Software/ConsoleKit
diff --git a/sysutils/consolekit/pkg-plist b/sysutils/consolekit/pkg-plist
new file mode 100644
index 000000000..8a490403d
--- /dev/null
+++ b/sysutils/consolekit/pkg-plist
@@ -0,0 +1,43 @@
+bin/ck-history
+bin/ck-launch-session
+bin/ck-list-sessions
+sbin/ck-log-system-restart
+sbin/ck-log-system-start
+sbin/ck-log-system-stop
+etc/ConsoleKit/seats.d/00-primary.seat
+etc/dbus-1/system.d/ConsoleKit.conf
+include/ConsoleKit/ck-connector/ck-connector.h
+lib/ConsoleKit/scripts/ck-system-restart
+lib/ConsoleKit/scripts/ck-system-stop
+lib/libck-connector.la
+lib/libck-connector.so
+lib/libck-connector.so.0
+libdata/pkgconfig/ck-connector.pc
+libexec/ck-collect-session-info
+libexec/ck-get-x11-display-device
+libexec/ck-get-x11-server-pid
+sbin/console-kit-daemon
+share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
+share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
+share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
+share/dbus-1/system-services/org.freedesktop.ConsoleKit.service
+share/polkit-1/actions/org.freedesktop.consolekit.policy
+@exec mkdir -p %D/etc/ConsoleKit/run-session.d
+@exec mkdir -p %D/etc/ConsoleKit/run-seat.d
+@exec mkdir -p %D/lib/ConsoleKit/run-session.d
+@exec mkdir -p %D/lib/ConsoleKit/run-seat.d
+@dirrm lib/ConsoleKit/scripts
+@dirrmtry lib/ConsoleKit/run-session.d
+@dirrmtry lib/ConsoleKit/run-seat.d
+@dirrmtry lib/ConsoleKit
+@dirrm include/ConsoleKit/ck-connector
+@dirrm include/ConsoleKit
+@dirrm etc/ConsoleKit/seats.d
+@dirrmtry etc/ConsoleKit/run-session.d
+@dirrmtry etc/ConsoleKit/run-seat.d
+@dirrm etc/ConsoleKit
+@exec mkdir -p /var/run/ConsoleKit
+@exec mkdir -p /var/log/ConsoleKit
+@exec touch -f /var/log/ConsoleKit/history
+@unexec rm -rf /var/run/ConsoleKit 2>/dev/null || true
+@unexec rm -rf /var/log/ConsoleKit 2>/dev/null || true