summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-02 10:43:25 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-09-02 10:43:25 -0700
commit78d181dc74ffb3e67ee0d90780b86e00e03073eb (patch)
treeaf4fc08567fb47e2b7f8c053cdb2dedd5174d5f8
parent33c3dae16b632ab56b6b361273a48079eb0a41c4 (diff)
launchd: Added --with-launchd-id-prefix option to set non-standard launchd id prefix (org.x is still default)
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac6
-rw-r--r--privileged_startx/Makefile.am7
-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
7 files changed, 30 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index 951d51a..a9ae6c1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,10 +56,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 7e2fb82..7f354f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,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
@@ -123,8 +126,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/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/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)