nixpkgs/pkgs/by-name/me/meteor/main.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

57 lines
1.6 KiB
Diff

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
@@ -554,6 +554,44 @@
}).await());
} // Now exec; we're not coming back.
+ // BEGIN HACK
+ // patch shebang:
+ var fs = require('fs');
+ var path = require("path")
+ var Future = require("fibers/future")
+ 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
require('kexec')(executable, newArgv);
@@ -1485,4 +1523,4 @@
process.exit(ret);
}).run();
-//# sourceMappingURL=main.js.map
\ No newline at end of file
+//# sourceMappingURL=main.js.map