@solcreek/dew 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -0
- package/scripts/postinstall.js +50 -0
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solcreek/dew",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Ultra-lightweight VM for macOS. Sub-second boot. Hardware-level isolation.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/solcreek/dew"
|
|
9
|
+
},
|
|
10
|
+
"os": ["darwin"],
|
|
11
|
+
"bin": {
|
|
12
|
+
"dew": "bin/dew"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node scripts/postinstall.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { execSync } = require("child_process");
|
|
2
|
+
const { existsSync, writeFileSync, mkdirSync } = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
|
|
6
|
+
if (os.platform() !== "darwin") {
|
|
7
|
+
console.log("dew: skipping codesign (not macOS)");
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
12
|
+
const binary = path.join(binDir, "dew");
|
|
13
|
+
|
|
14
|
+
if (!existsSync(binary)) {
|
|
15
|
+
console.log("dew: binary not found, skipping codesign");
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const entitlements = path.join(__dirname, "entitlements.plist");
|
|
20
|
+
if (!existsSync(entitlements)) {
|
|
21
|
+
writeFileSync(
|
|
22
|
+
entitlements,
|
|
23
|
+
`<?xml version="1.0" encoding="UTF-8"?>
|
|
24
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
25
|
+
<plist version="1.0">
|
|
26
|
+
<dict>
|
|
27
|
+
<key>com.apple.security.virtualization</key>
|
|
28
|
+
<true/>
|
|
29
|
+
</dict>
|
|
30
|
+
</plist>`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
execSync(
|
|
36
|
+
`codesign --entitlements "${entitlements}" --force -s - "${binary}"`,
|
|
37
|
+
{ stdio: "pipe" }
|
|
38
|
+
);
|
|
39
|
+
console.log("dew: signed with virtualization entitlement");
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.log("dew: codesign failed (may need manual signing)");
|
|
42
|
+
console.log(` run: codesign --entitlements "${entitlements}" --force -s - "${binary}"`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Pull VM assets on first install
|
|
46
|
+
const dataDir = path.join(os.homedir(), ".local", "share", "dew");
|
|
47
|
+
const kernel = path.join(dataDir, "vmlinuz");
|
|
48
|
+
if (!existsSync(kernel)) {
|
|
49
|
+
console.log("dew: VM assets not found. Run 'dew assets pull' to download kernel + initramfs.");
|
|
50
|
+
}
|