summaryrefslogtreecommitdiff
path: root/sysutils/consolekit
diff options
context:
space:
mode:
authorhasso <hasso>2008-12-26 20:05:56 +0000
committerhasso <hasso>2008-12-26 20:05:56 +0000
commit98852ff9a4991bd02f3689afabdb3461da803acc (patch)
treed16a9dad205b3402ace993d2fe46631d436c6ced /sysutils/consolekit
parent6b2c5f32d421a2667c4cd2d3f7d92cbeaaf10b77 (diff)
downloadpkgsrc-98852ff9a4991bd02f3689afabdb3461da803acc.tar.gz
* Improves a lot FreeBSD and DragonFly support (from FreeBSD ports)
* Fixes two leak problems (from upstream bugzilla) * Bump PKGREVISION
Diffstat (limited to 'sysutils/consolekit')
-rw-r--r--sysutils/consolekit/Makefile15
-rw-r--r--sysutils/consolekit/distinfo8
-rw-r--r--sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD35
-rw-r--r--sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD17
-rw-r--r--sysutils/consolekit/patches/patch-ae24
-rw-r--r--sysutils/consolekit/patches/patch-af152
-rw-r--r--sysutils/consolekit/patches/patch-ag15
-rw-r--r--sysutils/consolekit/patches/patch-ah14
8 files changed, 264 insertions, 16 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
index 125ebb4cc9d..d4cada207f9 100644
--- a/sysutils/consolekit/Makefile
+++ b/sysutils/consolekit/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.6 2008/12/10 11:43:20 dsainty Exp $
+# $NetBSD: Makefile,v 1.7 2008/12/26 20:05:56 hasso Exp $
#
CONSOLEKIT_VER= 0.3.0
DISTNAME= ConsoleKit-${CONSOLEKIT_VER}
PKGNAME= consolekit-${CONSOLEKIT_VER}
-PKGREVISION= 2
+PKGREVISION= 3
CATEGORIES= sysutils
MASTER_SITES= http://people.freedesktop.org/~mccann/dist/
EXTRACT_SUFX= .tar.bz2
@@ -40,11 +40,20 @@ CONFIGURE_ARGS+= --localstatedir=${VARBASE}
#.include "../../mk/pam.buildlink3.mk"
post-extract:
- cp ${FILESDIR}/ck-sysdeps-netbsd.c ${WRKSRC}/src/
+ ${CP} ${FILESDIR}/ck-sysdeps-netbsd.c ${WRKSRC}/src/
pre-configure:
cd ${WRKSRC} && autoreconf -vi
+.include "../../mk/bsd.prefs.mk"
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+post-install:
+ ${CP} ${FILESDIR}/ck-get-x11-display-device.FreeBSD \
+ ${DESTDIR}${PREFIX}/libexec/ck-get-x11-display-device
+ ${CP} ${FILESDIR}/ck-get-x11-server-pid.FreeBSD \
+ ${DESTDIR}${PREFIX}/libexec/ck-get-x11-server-pid
+.endif
+
.include "../../devel/zlib/buildlink3.mk"
.include "../../security/policykit/buildlink3.mk"
.include "../../sysutils/dbus/buildlink3.mk"
diff --git a/sysutils/consolekit/distinfo b/sysutils/consolekit/distinfo
index 7c52c196217..c687fbe883f 100644
--- a/sysutils/consolekit/distinfo
+++ b/sysutils/consolekit/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2008/12/23 21:46:14 jmcneill Exp $
+$NetBSD: distinfo,v 1.6 2008/12/26 20:05:56 hasso Exp $
SHA1 (ConsoleKit-0.3.0.tar.bz2) = e3b6156622cc14ebca7382a55b8ed15f2f2bad98
RMD160 (ConsoleKit-0.3.0.tar.bz2) = 7a1ebd2f4bfb65690e70138c9923c3fd2fcaf671
@@ -7,5 +7,7 @@ SHA1 (patch-aa) = a1589faf05d5358a0820da6d7da20f09ce4cec1b
SHA1 (patch-ab) = 2e9fe9de1f27c635a4eefa77af8322cb8a02ab35
SHA1 (patch-ac) = 0595a9cd1c4013eb4761e044b4b4b01b613f7d2b
SHA1 (patch-ad) = a1c1a1d0452945550065da3eac2390318c1eb7be
-SHA1 (patch-ae) = 0b5bea5260b8595fc9dfef6340ff47b1545b0bec
-SHA1 (patch-af) = ad854bcde3f8defefb476ccec3f68e64d4c055ec
+SHA1 (patch-ae) = 8a9612cd35d1ec86240fd17dfa6963c20edc0ad0
+SHA1 (patch-af) = e86c63147798d61f7560cfe7547b0d06d18d5583
+SHA1 (patch-ag) = 724e2eb95f7ca78c5659fde1eec2f2c5c6bc5002
+SHA1 (patch-ah) = f62d8c661732a4ea47e29b99f883b539fb5c7468
diff --git a/sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD b/sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD
new file mode 100644
index 00000000000..6fc508360b9
--- /dev/null
+++ b/sysutils/consolekit/files/ck-get-x11-display-device.FreeBSD
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+FSTAT="/usr/bin/fstat"
+GREP="/usr/bin/grep"
+AWK="/usr/bin/awk"
+SED="/usr/bin/sed"
+CAT="/bin/cat"
+HEAD="/usr/bin/head"
+
+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 | ${HEAD} -1 | ${AWK} '{print $8}')
+
+if [ -z "${device}" ]; then
+ echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
+ exit 1
+fi
+
+echo "/dev/${device}"
diff --git a/sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD b/sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD
new file mode 100644
index 00000000000..05c433e0175
--- /dev/null
+++ b/sysutils/consolekit/files/ck-get-x11-server-pid.FreeBSD
@@ -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/patches/patch-ae b/sysutils/consolekit/patches/patch-ae
index 7681ef67486..6f74bf54d0d 100644
--- a/sysutils/consolekit/patches/patch-ae
+++ b/sysutils/consolekit/patches/patch-ae
@@ -1,7 +1,7 @@
-$NetBSD: patch-ae,v 1.4 2008/11/25 13:40:05 hasso Exp $
+$NetBSD: patch-ae,v 1.5 2008/12/26 20:05:56 hasso Exp $
---- src/ck-sysdeps-unix.c.orig 2008-01-23 16:30:44 +0200
-+++ src/ck-sysdeps-unix.c 2008-11-25 12:34:32 +0200
+--- src/ck-sysdeps-unix.c.orig 2008-11-27 05:10:25 +0200
++++ src/ck-sysdeps-unix.c 2008-11-27 05:09:59 +0200
@@ -35,6 +35,11 @@
#include <linux/kd.h>
#endif
@@ -80,7 +80,23 @@ $NetBSD: patch-ae,v 1.4 2008/11/25 13:40:05 hasso Exp $
kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
#else
kb_ok = 1;
-@@ -184,6 +217,14 @@ ck_get_a_console_fd (void)
+@@ -172,6 +205,15 @@ ck_get_a_console_fd (void)
+
+ fd = -1;
+
++#if defined(__FreeBSD__) || defined(__DragonFly__)
++ /* 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");
+@@ -184,6 +226,14 @@ ck_get_a_console_fd (void)
}
#endif
diff --git a/sysutils/consolekit/patches/patch-af b/sysutils/consolekit/patches/patch-af
index 00cd122c704..de435e7568a 100644
--- a/sysutils/consolekit/patches/patch-af
+++ b/sysutils/consolekit/patches/patch-af
@@ -1,8 +1,16 @@
-$NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $
+$NetBSD: patch-af,v 1.2 2008/12/26 20:05:56 hasso Exp $
---- src/ck-sysdeps-freebsd.c.orig 2008-11-25 14:43:51 +0200
-+++ src/ck-sysdeps-freebsd.c 2008-11-25 14:50:24 +0200
-@@ -151,14 +151,38 @@ stat2proc (pid_t pid,
+--- src/ck-sysdeps-freebsd.c.orig 2008-11-27 05:12:41 +0200
++++ src/ck-sysdeps-freebsd.c 2008-11-27 05:08:28 +0200
+@@ -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>
+@@ -151,14 +152,38 @@ stat2proc (pid_t pid,
return FALSE;
}
@@ -41,7 +49,7 @@ $NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $
P->pid = p.ki_pid;
P->ppid = p.ki_ppid;
P->pgrp = p.ki_pgid;
-@@ -173,19 +197,33 @@ stat2proc (pid_t pid,
+@@ -173,19 +198,33 @@ stat2proc (pid_t pid,
P->tpgid = p.ki_tpgid;
P->processor = p.ki_oncpu;
P->nlwp = p.ki_numthreads;
@@ -75,7 +83,23 @@ $NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $
memcpy (P->tty_text, " ? ", sizeof P->tty_text);
}
-@@ -308,7 +346,11 @@ ck_unix_pid_get_uid (pid_t pid)
+@@ -202,7 +241,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 +255,6 @@ ck_process_stat_new_for_unix_pid (pid_t
+ if (res) {
+ *stat = proc;
+ } else {
+- g_propagate_error (error, local_error);
+ *stat = NULL;
+ }
+
+@@ -308,7 +345,11 @@ ck_unix_pid_get_uid (pid_t pid)
res = get_kinfo_proc (pid, &p);
if (res) {
@@ -87,3 +111,119 @@ $NetBSD: patch-af,v 1.1 2008/11/25 13:40:05 hasso Exp $
}
return uid;
+@@ -327,38 +368,40 @@ 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;
+- }
+-
+- while ((t = getttyent ()) != NULL) {
+- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
++ g.gl_offs = 0;
++ glob ("/dev/ttyv*", GLOB_DOOFFS, NULL, &g);
++ for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
++ int fd;
++ char *cdev;
++
++ cdev = g.gl_pathv[i];
++ fd = open (cdev, O_RDONLY | O_NOCTTY);
++ if (fd > -1) {
++ close (fd);
+ 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 +412,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 +427,7 @@ ck_get_console_num_from_device (const ch
+ guint *num)
+ {
+ guint n;
++ char c;
+ gboolean ret;
+
+ n = 0;
+@@ -388,7 +437,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 +461,7 @@ ck_get_active_console_num (int consol
+ gboolean ret;
+ int res;
+ int active;
++ char ttyn;
+
+ g_assert (console_fd != -1);
+
+@@ -420,7 +474,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/patches/patch-ag b/sysutils/consolekit/patches/patch-ag
new file mode 100644
index 00000000000..06e49728489
--- /dev/null
+++ b/sysutils/consolekit/patches/patch-ag
@@ -0,0 +1,15 @@
+$NetBSD: patch-ag,v 1.1 2008/12/26 20:05:57 hasso Exp $
+
+https://bugs.freedesktop.org/show_bug.cgi?id=18330
+
+--- src/ck-session.c.orig 2008-11-27 05:49:11 +0200
++++ src/ck-session.c 2008-11-27 08:51:37 +0200
+@@ -1100,6 +1100,8 @@ ck_session_finalize (GObject *object)
+
+ session_remove_activity_watch (session);
+
++ g_object_unref (session->priv->bus_proxy);
++
+ g_free (session->priv->id);
+ g_free (session->priv->cookie);
+ g_free (session->priv->seat_id);
diff --git a/sysutils/consolekit/patches/patch-ah b/sysutils/consolekit/patches/patch-ah
new file mode 100644
index 00000000000..e15a8b9e472
--- /dev/null
+++ b/sysutils/consolekit/patches/patch-ah
@@ -0,0 +1,14 @@
+$NetBSD: patch-ah,v 1.1 2008/12/26 20:05:57 hasso Exp $
+
+https://bugs.freedesktop.org/show_bug.cgi?id=17893
+
+--- src/ck-run-programs.c.orig 2008-11-27 08:52:06 +0200
++++ src/ck-run-programs.c 2008-11-27 08:52:40 +0200
+@@ -225,6 +225,7 @@ ck_run_programs (const char *dirpath,
+ out_loop:
+ g_free (child_argv[0]);
+ }
++ g_dir_close (dir);
+ out:
+ g_strfreev (env_for_child);
+ }