summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Taylor <rob.taylor@codethink.co.uk>2007-08-22 14:43:28 +0100
committerRob Taylor <rob.taylor@codethink.co.uk>2007-08-22 15:17:50 +0100
commitdae3b4dd679d9209afa9447298e8a056ebefc411 (patch)
treecb92aba7dbebd1d0481bf823931fffbc6afb6b94
parent06e0d187cf16ad9f093b2d5136dca50e2fe8f3c3 (diff)
add configure flag for .Xauthorty directory on single-user-devices
Adds the manditory configure flag --with-xauth-dir= for the directory in which to find a .Xauthority for the xserver instance on single-user-devices, e.g. OLPC and N800. For now configure assumes builds are only for single-user devices. Multiple-user cases will require ConsoleKit integration, and some work on ConsoleKit.
-rw-r--r--configure.in19
-rw-r--r--plugins/glue/xorg/ohm-plugin-xorg.c21
2 files changed, 33 insertions, 7 deletions
diff --git a/configure.in b/configure.in
index b09441d..9eda015 100644
--- a/configure.in
+++ b/configure.in
@@ -112,6 +112,25 @@ AC_SUBST(OHM_PLUGIN_DIR, "\$(libdir)/ohm")
AC_SUBST(OHM_PLUGIN_CFLAGS, "-I\$(top_srcdir)/ohmd $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS")
AC_SUBST(OHM_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS")
+dnl Assume single-user-device for now
+single_user_device="yes"
+
+if test "$single_user_device" = yes; then
+ AC_DEFINE(OHM_SINGLE_USER_DEVICE, 1, [Whether OHM is built for a single-user device with a known .Xauthority location])
+
+ AC_ARG_WITH(xauth-dir,
+ [AC_HELP_STRING([--with-xauth-dir=<dir>],
+ [directory where we can find .Xauthority (for single-user device)]
+ )]
+ )
+
+ if test -z "$with_xauth_dir"; then
+ AC_MSG_ERROR([Must use --with-xauth-dir for a single-user device])
+ else
+ AC_DEFINE(OHM_DEVICE_XAUTH_DIR, "$xauth_dir", [Where to find .Xauthority])
+ fi
+fi
+
dnl ---------------------------------------------------------------------------
dnl - Where should we put documentation ?
dnl ---------------------------------------------------------------------------
diff --git a/plugins/glue/xorg/ohm-plugin-xorg.c b/plugins/glue/xorg/ohm-plugin-xorg.c
index 3f0b226..f91c8af 100644
--- a/plugins/glue/xorg/ohm-plugin-xorg.c
+++ b/plugins/glue/xorg/ohm-plugin-xorg.c
@@ -35,20 +35,27 @@ plugin_poll_startup (gpointer data)
gboolean ret;
const gchar *xauth;
- /* we should search all of home */
- xauth = "/home/olpc/.Xauthority";
+#ifdef OHM_SINGLE_USER_DEVICE
+ xauth = OHM_DEVICE_XAUTH_DIR "/.Xauthority";
+ g_debug ("xorg: testing %s", xauth);
ret = g_file_test (xauth, G_FILE_TEST_EXISTS);
- /* be nice to hughsie... */
+ /* be nice to developers... */
if (ret == FALSE) {
- xauth = "/home/hughsie/.Xauthority";
- ret = g_file_test (xauth, G_FILE_TEST_EXISTS);
+ const char *home = getenv("HOME");
+ if (home != NULL) {
+ xauth = g_strdup_printf ("%s/.Xauthority", home);
+ g_debug ("xorg: testing %s", xauth);
+ ret = g_file_test (xauth, G_FILE_TEST_EXISTS);
+ }
}
if (ret == FALSE) {
- /* not yet */
+ g_debug ("xorg: no .Xauthority found");
return TRUE;
}
-
+#else
+#error ConsoleKit support not yet implemented
+#endif
/* woot! X is alive */
g_debug ("Got X!");
ohm_plugin_conf_set_key (plugin, "xorg.has_xauthority", 1);