Bring in several fixes from FreeBSD and fd.o bugzilla.

Fix tty names, cmd arguments... Install the stop/restart scripts.
Remove policykit support for now.
This commit is contained in:
ajacoutot 2009-11-13 14:52:33 +00:00
parent ba48cd1fd9
commit eb874011f3
12 changed files with 151 additions and 32 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.4 2009/10/27 12:00:22 jasper Exp $
# $OpenBSD: Makefile,v 1.5 2009/11/13 14:52:33 ajacoutot Exp $
BROKEN= WIP does not work yet
COMMENT= Framework for defining and tracking users
DISTNAME= ConsoleKit-0.3.0
PKGNAME= ${DISTNAME:L}p2
PKGNAME= ${DISTNAME:L}p3
CATEGORIES= sysutils
@ -23,22 +23,20 @@ PERMIT_DISTFILES_FTP= Yes
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
WANTLIB += X11 Xau Xdmcp c dbus-1 dbus-glib-1 expat glib-2.0 gobject-2.0
WANTLIB += gthread-2.0 kvm pcre pthread pthread-stubs xcb z
WANTLIB += X11 Xau Xdmcp c dbus-1 glib-2.0 gobject-2.0 gthread-2.0
WANTLIB += kvm pcre pthread pthread-stubs xcb z
MASTER_SITES= ftp://ftp.fr.freebsd.org/pub/FreeBSD/distfiles/
LIB_DEPENDS= polkit::sysutils/policykit
MODULES= devel/gettext
LIB_DEPENDS= dbus-glib-1.>=4::x11/dbus-glib
AUTOCONF_VERSION= 2.61
CONFIGURE_STYLE= autoconf
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--localstatedir=/var \
--with-pid-file=/var/run/consolekit.pid \
--with-authfw=bsdauth \
--with-os-type=openbsd
--with-pid-file=/var/run/consolekit.pid
CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include"
USE_LIBTOOL= Yes
@ -52,4 +50,11 @@ pre-patch:
cp -R freebsd openbsd && \
perl -pi -e "s,freebsd,openbsd,g" openbsd/Makefile.in
# from FreeBSD ports
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
.include <bsd.port.mk>

View File

@ -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} ttyC | ${HEAD} -1 | ${AWK} '{print $9}')
if [ -z "${device}" ]; then
echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
exit 1
fi
echo "/dev/${device}"

View File

@ -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}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure_ac,v 1.2 2009/10/16 09:36:56 ajacoutot Exp $
--- configure.ac.orig Sat May 30 23:09:15 2009
+++ configure.ac Sat May 30 23:10:16 2009
$OpenBSD: patch-configure_ac,v 1.3 2009/11/13 14:52:33 ajacoutot Exp $
--- configure.ac.orig Thu Jul 31 02:35:53 2008
+++ configure.ac Fri Nov 13 12:40:53 2009
@@ -176,6 +176,14 @@ dnl --------------------------------------------------
CK_BACKEND=""
KVM_LIBS=""
@ -32,7 +32,3 @@ $OpenBSD: patch-configure_ac,v 1.2 2009/10/16 09:36:56 ajacoutot Exp $
tools/solaris/Makefile
data/Makefile
doc/Makefile
@@ -441,4 +451,4 @@ if test x${have_polkit} = xno -a x${msg_rbac_shutdown}
echo " a huge SECURITY HOLE. I repeat: YOU NEED TO EDIT THE FILE"
echo " ConsoleKit.conf to match your distro/site to avoid NASTY SECURITY HOLES."
echo ""

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-data_ConsoleKit_conf,v 1.1 2009/11/13 14:52:33 ajacoutot Exp $
--- data/ConsoleKit.conf.orig Fri Nov 13 15:16:35 2009
+++ data/ConsoleKit.conf Fri Nov 13 15:17:05 2009
@@ -90,6 +90,8 @@
<allow send_interface="org.freedesktop.ConsoleKit.Session"
send_member="GetIdleHint"/>
<allow send_interface="org.freedesktop.ConsoleKit.Session"
+ send_member="SetIdleHint"/>
+ <allow send_interface="org.freedesktop.ConsoleKit.Session"
send_member="GetIdleSinceHint"/>
</policy>

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-src_ck-manager_c,v 1.1 2009/11/13 14:52:33 ajacoutot Exp $
Allow shutdown on systems not using policykit.
https://bugzilla.gnome.org/show_bug.cgi?id=549150
--- src/ck-manager.c.orig Wed Jul 30 23:53:07 2008
+++ src/ck-manager.c Fri Nov 13 12:41:12 2009
@@ -1349,7 +1349,6 @@ ck_manager_restart (CkManager *manager,
}
#else
g_warning ("Compiled without PolicyKit or RBAC support!");
- goto out;
#endif
g_debug ("ConsoleKit preforming Restart: %s", action);
@@ -1409,7 +1408,6 @@ ck_manager_stop (CkManager *manager,
}
#else
g_warning ("Compiled without PolicyKit or RBAC support!");
- goto out;
#endif
g_debug ("Stopping system");

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-src_ck-session_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp $
$OpenBSD: patch-src_ck-session_c,v 1.3 2009/11/13 14:52:33 ajacoutot Exp $
https://bugs.freedesktop.org/show_bug.cgi?id=18330
--- src/ck-session.c.orig Sun May 31 19:37:12 2009
+++ src/ck-session.c Sun May 31 19:37:38 2009
--- src/ck-session.c.orig Thu Jul 31 02:36:10 2008
+++ src/ck-session.c Fri Nov 13 12:40:48 2009
@@ -1100,6 +1100,8 @@ ck_session_finalize (GObject *object)
session_remove_activity_watch (session);

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp $
$OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.3 2009/11/13 14:52:33 ajacoutot Exp $
--- src/ck-sysdeps-openbsd.c.orig Sun May 31 04:10:36 2009
+++ src/ck-sysdeps-openbsd.c Sun May 31 19:24:53 2009
@@ -0,0 +1,412 @@
@ -197,7 +197,7 @@ $OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp
+
+ if (p.p_tdev == NODEV) {
+ /* XXXJDM nasty hack */
+ memcpy (P->tty_text, "/dev/ttyE4", sizeof P->tty_text);
+ memcpy (P->tty_text, "/dev/ttyC4", sizeof P->tty_text);
+ }
+
+ if (P->pid != pid) {
@ -353,7 +353,7 @@ $OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp
+ /* The device number is always one less than the VT number. */
+ num--;
+
+ device = g_strdup_printf ("/dev/ttyE%u", num);
+ device = g_strdup_printf ("/dev/ttyC%u", num);
+
+ return device;
+}
@ -372,7 +372,7 @@ $OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp
+ return FALSE;
+ }
+
+ if (sscanf (device, "/dev/ttyE%u", &n) == 1) {
+ if (sscanf (device, "/dev/ttyC%u", &n) == 1) {
+ /* The VT number is always one more than the device number. */
+ n++;
+ ret = TRUE;
@ -404,7 +404,7 @@ $OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.2 2009/10/16 09:36:56 ajacoutot Exp
+ goto out;
+ }
+
+ g_debug ("Active VT is: %d (ttyE%d)", active, active - 1);
+ g_debug ("Active VT is: %d (ttyC%d)", active, active - 1);
+ ret = TRUE;
+
+ out:

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-src_ck-sysdeps-unix_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
$OpenBSD: patch-src_ck-sysdeps-unix_c,v 1.2 2009/11/13 14:52:33 ajacoutot Exp $
--- src/ck-sysdeps-unix.c.orig Sun May 31 19:27:59 2009
+++ src/ck-sysdeps-unix.c Sun May 31 19:40:26 2009
@@ -35,6 +35,11 @@
@ -38,7 +38,7 @@ $OpenBSD: patch-src_ck-sysdeps-unix_c,v 1.1.1.1 2009/06/07 02:55:19 robert Exp $
+#endif
+
+#if defined(__OpenBSD__)
+ fd = open_a_console ("/dev/ttyC0");
+ fd = open_a_console ("/dev/ttyC4");
+ if (fd >= 0) {
+ goto done;
+ }

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-tools_Makefile_in,v 1.1 2009/11/13 14:52:33 ajacoutot Exp $
--- tools/Makefile.in.orig Thu Jul 31 02:41:10 2008
+++ tools/Makefile.in Fri Nov 13 12:40:53 2009
@@ -35,6 +35,7 @@ host_triplet = @host@
@CK_COMPILE_LINUX_TRUE@am__append_1 = linux
@CK_COMPILE_FREEBSD_TRUE@am__append_2 = freebsd
@CK_COMPILE_SOLARIS_TRUE@am__append_3 = solaris
+@CK_COMPILE_OPENBSD_TRUE@am__append_3 = openbsd
bin_PROGRAMS = ck-launch-session$(EXEEXT) ck-list-sessions$(EXEEXT) \
ck-history$(EXEEXT) $(am__EXEEXT_1)
sbin_PROGRAMS = ck-log-system-start$(EXEEXT) \
@@ -304,6 +305,7 @@ DIST_SUBDIRS = \
linux \
freebsd \
solaris \
+ openbsd \
$(NULL)
INCLUDES = \

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-tools_openbsd_ck-system-stop,v 1.1 2009/11/13 14:52:33 ajacoutot Exp $
--- tools/openbsd/ck-system-stop.orig Fri Nov 13 12:14:17 2009
+++ tools/openbsd/ck-system-stop Fri Nov 13 12:14:44 2009
@@ -8,7 +8,7 @@ unsupported() {
#Try for common tools
if [ -x "/sbin/shutdown" ] ; then
- /sbin/shutdown -p now
+ /sbin/shutdown -hp now
exit $?
elif [ -x "/usr/sbin/shutdown" ] ; then
/usr/sbin/shutdown -p now

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.2 2009/06/07 07:49:44 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.3 2009/11/13 14:52:33 ajacoutot Exp $
%%SHARED%%
@bin bin/ck-history
@bin bin/ck-launch-session
@ -8,20 +8,20 @@ include/ConsoleKit/ck-connector/
include/ConsoleKit/ck-connector/ck-connector.h
lib/ConsoleKit/
lib/ConsoleKit/run-session.d/
lib/ConsoleKit/scripts/
lib/ConsoleKit/scripts/ck-system-restart
lib/ConsoleKit/scripts/ck-system-stop
lib/libck-connector.a
lib/libck-connector.la
lib/pkgconfig/
lib/pkgconfig/ck-connector.pc
@bin libexec/ck-collect-session-info
@bin libexec/ck-get-x11-display-device
@bin libexec/ck-get-x11-server-pid
libexec/ck-get-x11-display-device
libexec/ck-get-x11-server-pid
@bin sbin/ck-log-system-restart
@bin sbin/ck-log-system-start
@bin sbin/ck-log-system-stop
@bin sbin/console-kit-daemon
share/PolicyKit/
share/PolicyKit/policy/
share/PolicyKit/policy/org.freedesktop.consolekit.policy
share/dbus-1/
share/dbus-1/interfaces/
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml