aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--darwin-bootstrap/com.ex.substituted.plist18
-rw-r--r--darwin-bootstrap/inject-into-launchd.c2
-rw-r--r--darwin-bootstrap/posixspawn-hook.c6
-rwxr-xr-xscript/gen-deb.sh5
4 files changed, 26 insertions, 5 deletions
diff --git a/darwin-bootstrap/com.ex.substituted.plist b/darwin-bootstrap/com.ex.substituted.plist
new file mode 100644
index 0000000..4f30051
--- /dev/null
+++ b/darwin-bootstrap/com.ex.substituted.plist
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>ProcessType</key>
+ <string>Interactive</string>
+ <key>MachServices</key>
+ <dict>
+ <key>com.ex.substituted</key>
+ <true/>
+ </dict>
+ <key>Label</key>
+ <string>com.ex.substituted</string>
+ <key>Program</key>
+ <string>/Library/Substitute/Helpers/substituted</string>
+</dict>
+</plist>
+
diff --git a/darwin-bootstrap/inject-into-launchd.c b/darwin-bootstrap/inject-into-launchd.c
index 539b1a2..cfe8927 100644
--- a/darwin-bootstrap/inject-into-launchd.c
+++ b/darwin-bootstrap/inject-into-launchd.c
@@ -67,7 +67,7 @@ int main(UNUSED int argc, char **argv) {
ib_log("mach_port_allocate: %x", kr);
return 0;
}
- const char *lib = "/Library/Substitute/posixspawn-hook.dylib";
+ const char *lib = "/Library/Substitute/Helpers/posixspawn-hook.dylib";
struct shuttle shuttle = {
.type = SUBSTITUTE_SHUTTLE_MACH_PORT,
.u.mach.right_type = MACH_MSG_TYPE_MAKE_SEND,
diff --git a/darwin-bootstrap/posixspawn-hook.c b/darwin-bootstrap/posixspawn-hook.c
index e948b16..b467ca5 100644
--- a/darwin-bootstrap/posixspawn-hook.c
+++ b/darwin-bootstrap/posixspawn-hook.c
@@ -52,7 +52,7 @@ static bool advance(char **strp, const char *template) {
}
static bool spawn_unrestrict(pid_t pid, bool should_resume, bool is_exec) {
- const char *prog = "/Library/Substitute/unrestrict";
+ const char *prog = "/Library/Substitute/Helpers/unrestrict";
char pid_s[32];
sprintf(pid_s, "%ld", (long) pid);
const char *should_resume_s = should_resume ? "1" : "0";
@@ -169,9 +169,9 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old,
static const char bl_dylib[] =
- "/Library/Substitute/bundle-loader.dylib";
+ "/Library/Substitute/Helpers/bundle-loader.dylib";
static const char psh_dylib[] =
- "/Library/Substitute/posixspawn-hook.dylib";
+ "/Library/Substitute/Helpers/posixspawn-hook.dylib";
/* which dylib should we add, if any? */
const char *dylib_to_add;
diff --git a/script/gen-deb.sh b/script/gen-deb.sh
index 81b3efb..c474e63 100755
--- a/script/gen-deb.sh
+++ b/script/gen-deb.sh
@@ -14,7 +14,10 @@ mkdir -p $debroot/usr/include/substitute
cp lib/substitute.h $debroot/usr/include/substitute/
cp substrate/substrate.h $debroot/usr/include/substitute/
mkdir -p $debroot/Library/Substitute/DynamicLibraries
-cp out/{posixspawn-hook.dylib,bundle-loader.dylib,unrestrict,inject-into-launchd} $debroot/Library/Substitute/
+mkdir -p $debroot/Library/Substitute/Helpers
+cp out/{posixspawn-hook.dylib,bundle-loader.dylib,unrestrict,inject-into-launchd,substituted} $debroot/Library/Substitute/Helpers/
+mkdir -p $debroot/Library/LaunchDaemons
+cp darwin-bootstrap/com.ex.substituted.plist $debroot/Library/LaunchDaemons/
cp -a DEBIAN $debroot/
sed "s#{VERSION}#$version#g" DEBIAN/control > $debroot/DEBIAN/control
#... add bootstrap stuff