@dinglebear/unraid 0.2.5 → 0.3.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/lib/platform.js CHANGED
@@ -12,7 +12,7 @@ function binaryVersion() {
12
12
 
13
13
  function targetFor(platform = process.platform, arch = process.arch) {
14
14
  if (platform === "linux" && arch === "x64") {
15
- return { asset: "runraid-x86_64.tar.gz", binary: "runraid" };
15
+ return { asset: "runraid-x86_64.tar.gz", archiveBinary: "runraid-linux-x86_64", binary: "runraid" };
16
16
  }
17
17
  throw new Error(`Unsupported platform ${platform}/${arch}. Supported target: linux/x64.`);
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dinglebear/unraid",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Rust MCP server and CLI for Unraid GraphQL operations across NAS, Docker, VM, and storage workflows.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/dinglebear-ai/unraid#readme",
@@ -55,7 +55,7 @@
55
55
  "oauth"
56
56
  ],
57
57
  "mcpName": "ai.dinglebear/unraid",
58
- "binaryVersion": "0.2.5",
58
+ "binaryVersion": "0.3.0",
59
59
  "author": {
60
60
  "name": "dinglebear.ai",
61
61
  "url": "https://dinglebear.ai"
@@ -71,6 +71,18 @@ function extract(archive, destination) {
71
71
  const result = spawnSync("tar", ["-xzf", archive, "-C", destination], { encoding: "utf8" });
72
72
  if (result.status !== 0) throw new Error((result.stderr || result.stdout || "tar extraction failed").trim());
73
73
  }
74
+
75
+ function promoteExtractedBinary(target, destination, root = installRoot()) {
76
+ const extracted = path.join(root, target.archiveBinary || target.binary);
77
+ if (!fs.existsSync(extracted)) {
78
+ throw new Error(`archive did not contain expected binary ${path.basename(extracted)}`);
79
+ }
80
+ if (path.resolve(extracted) !== path.resolve(destination)) {
81
+ fs.rmSync(destination, { force: true });
82
+ fs.renameSync(extracted, destination);
83
+ }
84
+ fs.chmodSync(destination, 0o755);
85
+ }
74
86
  async function main() {
75
87
  if (process.env.UNRAID_RMCP_SKIP_DOWNLOAD === "1") { log("skipping binary download because UNRAID_RMCP_SKIP_DOWNLOAD=1"); return; }
76
88
  const target = targetFor();
@@ -84,8 +96,12 @@ async function main() {
84
96
  await download(url, archive);
85
97
  await verifyChecksum(url, archive);
86
98
  extract(archive, installRoot());
87
- fs.chmodSync(destination, 0o755);
99
+ promoteExtractedBinary(target, destination);
88
100
  log(`installed ${destination}`);
89
101
  } finally { fs.rmSync(tempDir, { recursive: true, force: true }); }
90
102
  }
91
- main().catch((error) => { log(error.message); process.exitCode = 1; });
103
+ if (require.main === module) {
104
+ main().catch((error) => { log(error.message); process.exitCode = 1; });
105
+ }
106
+
107
+ module.exports = { checksumFromText, promoteExtractedBinary };