2015-09-25 10:00:16 +00:00
|
|
|
diff --git a/tools/cli/main.js b/tools/cli/main.js
|
|
|
|
index 84f94bc..4fbda17 100644
|
|
|
|
--- a/tools/cli/main.js
|
|
|
|
+++ b/tools/cli/main.js
|
2017-09-13 19:35:36 +00:00
|
|
|
@@ -554,6 +554,44 @@
|
|
|
|
}).await());
|
|
|
|
} // Now exec; we're not coming back.
|
2015-09-25 10:00:16 +00:00
|
|
|
|
|
|
|
+ // BEGIN HACK
|
|
|
|
+ // patch shebang:
|
|
|
|
+ var fs = require('fs');
|
|
|
|
+ var path = require("path")
|
2017-05-26 06:41:42 +00:00
|
|
|
+ var Future = require("fibers/future")
|
2015-09-25 10:00:16 +00:00
|
|
|
+ var srcOld = fs.readFileSync(executable, 'utf8');
|
|
|
|
+ srcNew = srcOld.replace(/^#!\/bin\/bash/, '#!/bin/sh');
|
|
|
|
+ if (srcOld !== srcNew) {
|
|
|
|
+ fs.writeFileSync(executable, srcNew, 'utf8');
|
|
|
|
+ }
|
|
|
|
+ // patch elfs:
|
|
|
|
+ var dir = path.dirname(executable);
|
|
|
|
+ var interpreter = "@INTERPRETER@";
|
|
|
|
+ var rpath = "@RPATH@";
|
|
|
|
+ function spawnSync(/*...*/) {
|
|
|
|
+ var args = Array.prototype.slice.call(arguments);
|
|
|
|
+ var proc = require("child_process").spawn.apply(null, args);
|
|
|
|
+ var future = new Future();
|
|
|
|
+ proc.on('close', function (code) {
|
|
|
|
+ future.return();
|
|
|
|
+ });
|
|
|
|
+ return future.wait();
|
|
|
|
+ }
|
|
|
|
+ function patchelf(/*...*/) {
|
|
|
|
+ var pathParts = Array.prototype.slice.call(arguments);
|
|
|
|
+ var p = path.join.apply(null, [dir, "dev_bundle"].concat(pathParts));
|
|
|
|
+ spawnSync('@PATCHELF@', [
|
|
|
|
+ "--set-interpreter",
|
|
|
|
+ interpreter,
|
|
|
|
+ "--set-rpath",
|
|
|
|
+ rpath,
|
|
|
|
+ p
|
|
|
|
+ ], {stdio: 'inherit'});
|
|
|
|
+ }
|
|
|
|
+ patchelf("bin", "node");
|
|
|
|
+ patchelf("mongodb", "bin", "mongo");
|
|
|
|
+ patchelf("mongodb", "bin", "mongod");
|
|
|
|
+ // END HACK
|
2017-09-13 19:35:36 +00:00
|
|
|
|
2015-09-25 10:00:16 +00:00
|
|
|
require('kexec')(executable, newArgv);
|
2017-09-13 19:35:36 +00:00
|
|
|
|
|
|
|
@@ -1485,4 +1523,4 @@
|
|
|
|
|
|
|
|
process.exit(ret);
|
|
|
|
}).run();
|
|
|
|
-//# sourceMappingURL=main.js.map
|
|
|
|
\ No newline at end of file
|
|
|
|
+//# sourceMappingURL=main.js.map
|