summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2009-09-05 17:31:12 +0200
committerMatthieu Herrb <matthieu.herrb@laas.fr>2009-09-05 17:31:12 +0200
commitf96e0b14bba177b055b50064b430115ff245ea1a (patch)
treee8c932e89df31659357b9d21f69cfd142197fc5a
parent312a3179638c36ef2b7aea4be70f24bd72851ce0 (diff)
parent98c7700d5bff9e61a7f29d8a611edc8a34961e8e (diff)
Merge commit 'origin/master' into obsd
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac6
-rw-r--r--org.x.startx.plist.cpp4
-rw-r--r--privileged_startx/Makefile.am7
-rw-r--r--privileged_startx/client.c4
-rw-r--r--privileged_startx/org.x.privileged_startx.plist.cpp4
-rw-r--r--privileged_startx/privileged_startx_types.h6
-rw-r--r--privileged_startx/server.c6
-rw-r--r--startx.cpp2
9 files changed, 34 insertions, 13 deletions
diff --git a/Makefile.am b/Makefile.am
index 6713d12..76ee2c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,10 +58,14 @@ CPP_FILES_FLAGS = \
-DXINITDIR=$(XINITDIR) $(PROGCPPDEFS) -DLIBDIR=$(libdir) \
-DSHELL_CMD=$(SHELL_CMD) $(STARTX_COOKIE_FLAGS) \
-D__libexecdir__="$(libexecdir)" \
- -D__bindir__="$(bindir)"
+ -D__bindir__="$(bindir)" \
+ -DLAUNCHD_ID_PREFIX="$(launchdidprefix)"
if LAUNCHD
-launchagents_PRE = org.x.startx.plist.cpp
+$(launchdidprefix).startx.plist.cpp: org.x.startx.plist.cpp
+ cp $< $@
+
+launchagents_PRE = $(launchdidprefix).startx.plist.cpp
launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
SUBDIRS = privileged_startx
diff --git a/configure.ac b/configure.ac
index 860e3d2..20ddb10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,9 @@ AC_ARG_WITH(launchagents-dir, AS_HELP_STRING([--with-launchagents-dir=PATH], [
AC_ARG_WITH(launchdaemons-dir, AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
[ launchdaemonsdir="${withval}" ],
[ launchdaemonsdir="/Library/LaunchDaemons" ])
+AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
+ [ launchdidprefix="${withval}" ],
+ [ launchdidprefix="org.x" ])
if test "x$LAUNCHD" = "xauto"; then
unset LAUNCHD
@@ -135,8 +138,11 @@ else
launchagentsdir=""
launchdaemonsdir=""
fi
+
+AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$launchdidprefix", [Prefix to use for launchd identifiers])
AC_SUBST([launchagentsdir])
AC_SUBST([launchdaemonsdir])
+AC_SUBST([launchdidprefix])
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
diff --git a/org.x.startx.plist.cpp b/org.x.startx.plist.cpp
index 4f3ce74..bd4c9e9 100644
--- a/org.x.startx.plist.cpp
+++ b/org.x.startx.plist.cpp
@@ -3,14 +3,14 @@
<plist version="1.0">
<dict>
<key>Label</key>
- <string>org.x.startx</string>
+ <string>LAUNCHD_ID_PREFIX.startx</string>
<key>ProgramArguments</key>
<array>
<string>__bindir__/startx</string>
</array>
<key>Sockets</key>
<dict>
- <key>:0</key>
+ <key>LAUNCHD_ID_PREFIX:0</key>
<dict>
<key>SecureSocketWithKey</key>
<string>DISPLAY</string>
diff --git a/privileged_startx/Makefile.am b/privileged_startx/Makefile.am
index 2d68544..453f6e7 100644
--- a/privileged_startx/Makefile.am
+++ b/privileged_startx/Makefile.am
@@ -34,7 +34,7 @@ xinitrc_PROGRAMS = privileged_startx
privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
AM_CPPFLAGS = -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
-CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)"
+CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)" -DLAUNCHD_ID_PREFIX="$(launchdidprefix)"
if TIGER_LAUNCHD
CPP_FILES_FLAGS += -DTIGER_LAUNCHD
@@ -55,7 +55,10 @@ BUILT_SOURCES = \
privileged_startxServer.h \
privileged_startx.h
-launchdaemons_PRE = org.x.privileged_startx.plist.cpp
+$(launchdidprefix).privileged_startx.plist.cpp: org.x.privileged_startx.plist.cpp
+ cp $< $@
+
+launchdaemons_PRE = $(launchdidprefix).privileged_startx.plist.cpp
launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
10-tmpdirs: 10-tmpdirs.cpp Makefile
diff --git a/privileged_startx/client.c b/privileged_startx/client.c
index a33dd02..8e1a771 100644
--- a/privileged_startx/client.c
+++ b/privileged_startx/client.c
@@ -45,9 +45,9 @@ int client_main(void) {
kr = bootstrap_look_up(bootstrap_port, BOOTSTRAP_NAME, &mp);
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
- fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
+ fprintf(stderr, "privileged_startx: bootstrap_look_up(%s): %s\n", BOOTSTRAP_NAME, bootstrap_strerror(kr));
#else
- fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr);
+ fprintf(stderr, "privileged_startx: bootstrap_look_up(%s): %ul\n", BOOTSTRAP_NAME, (unsigned long)kr);
#endif
exit(EXIT_FAILURE);
}
diff --git a/privileged_startx/org.x.privileged_startx.plist.cpp b/privileged_startx/org.x.privileged_startx.plist.cpp
index 7400cc4..02e1cce 100644
--- a/privileged_startx/org.x.privileged_startx.plist.cpp
+++ b/privileged_startx/org.x.privileged_startx.plist.cpp
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>Label</key>
- <string>org.x.privileged_startx</string>
+ <string>LAUNCHD_ID_PREFIX.privileged_startx</string>
<key>ProgramArguments</key>
<array>
<string>XINITDIR/privileged_startx</string>
@@ -16,7 +16,7 @@
#else
<key>MachServices</key>
<dict>
- <key>org.x.privileged_startx</key>
+ <key>LAUNCHD_ID_PREFIX.privileged_startx</key>
<true/>
</dict>
<key>TimeOut</key>
diff --git a/privileged_startx/privileged_startx_types.h b/privileged_startx/privileged_startx_types.h
index fef7195..8928e64 100644
--- a/privileged_startx/privileged_startx_types.h
+++ b/privileged_startx/privileged_startx_types.h
@@ -1,6 +1,10 @@
#ifndef _PRIV_STARTX_TYPES_H_
#define _PRIV_STARTX_TYPES_H_
-#define BOOTSTRAP_NAME "org.x.privileged_startx"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define BOOTSTRAP_NAME LAUNCHD_ID_PREFIX".privileged_startx"
#endif
diff --git a/privileged_startx/server.c b/privileged_startx/server.c
index 6dd4f2b..ee508db 100644
--- a/privileged_startx/server.c
+++ b/privileged_startx/server.c
@@ -26,6 +26,10 @@
* prior written authorization.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>
@@ -153,7 +157,7 @@ int server_main(const char *dir) {
mp = launch_data_get_machport(svc);
#else
- mp = checkin_or_register("org.x.privileged_startx");
+ mp = checkin_or_register(LAUNCHD_ID_PREFIX".privileged_startx");
#endif
if (mp == MACH_PORT_NULL) {
diff --git a/startx.cpp b/startx.cpp
index a1adbf5..664f120 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -85,7 +85,7 @@ serverargs=""
#ifdef __APPLE__
if [ "x$X11_PREFS_DOMAIN" = x ] ; then
- X11_PREFS_DOMAIN="org.x.X11"
+ X11_PREFS_DOMAIN=LAUNCHD_ID_PREFIX".X11"
fi
XCOMM Initialize defaults (this will cut down on "safe" error messages)