@centralu/host-linux-x64 0.1.0-beta.25 → 0.1.0-beta.27
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/host/bundle-info.json +3 -2
- package/host/centralu-package.json +5 -5
- package/host/codex-orchestrator-bridge.mjs +1 -0
- package/host/main.mjs +30061 -27905
- package/host/remote-install.mjs +15 -9
- package/package.json +1 -1
package/host/remote-install.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { spawnSync } from 'node:child_process'
|
|
|
11
11
|
import { createHash, randomBytes } from 'node:crypto'
|
|
12
12
|
import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
13
13
|
import { homedir } from 'node:os'
|
|
14
|
-
import { basename, join } from 'node:path'
|
|
14
|
+
import { basename, join, win32 } from 'node:path'
|
|
15
15
|
import { pathToFileURL } from 'node:url'
|
|
16
16
|
|
|
17
17
|
const WORD = /^[0-9A-Za-z][0-9A-Za-z.+-]{0,63}$/
|
|
@@ -176,9 +176,15 @@ function alive(pid) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
/**
|
|
180
|
+
* The system's tar. On Windows the one in System32 (bsdtar): a GNU tar on PATH reads `C:` as a host. Named by its whole
|
|
181
|
+
* path: a `SystemRoot` that is not one from a drive's root is not used (the host's `systemTool` rule, which this script
|
|
182
|
+
* cannot import), since Windows looks a relative program path up in the working directory first (#428).
|
|
183
|
+
*/
|
|
184
|
+
export function tarProgram(platform = process.platform, env = process.env) {
|
|
185
|
+
if (platform !== 'win32') return 'tar'
|
|
186
|
+
const root = /^[A-Za-z]:[\\/]/.test(env.SystemRoot ?? '') ? env.SystemRoot : 'C:\\Windows'
|
|
187
|
+
return win32.join(root, 'System32', 'tar.exe')
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
/** The tarball's bytes, refused unless their sha512 is the integrity the hub read from the signed metadata */
|
|
@@ -258,15 +264,15 @@ export async function install(p, { dataDir = process.env.CC_DATA_DIR || join(hom
|
|
|
258
264
|
const partial = join(l.root, `.partial-${p.version}-${process.pid}`)
|
|
259
265
|
rmSync(partial, { recursive: true, force: true })
|
|
260
266
|
try {
|
|
261
|
-
for (const
|
|
267
|
+
for (const pkg of p.packages) {
|
|
262
268
|
const bytes = await fetchChecked(pkg)
|
|
263
|
-
const file = join(partial, `${i}.tgz`)
|
|
264
269
|
const dest = join(partial, 'node_modules', ...pkg.name.split('/'))
|
|
265
270
|
mkdirSync(dest, { recursive: true })
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
// No path among the arguments (#849): Windows' tar takes its arguments in the ANSI code page, so a profile
|
|
272
|
+
// folder outside it (a name in another script) reached it as "?????" and the unpack failed. The archive comes
|
|
273
|
+
// on stdin, and the destination is the working folder, which Windows hands over whole
|
|
274
|
+
const r = spawnSync(tarProgram(), ['-xzf', '-', '--strip-components', '1'], { cwd: dest, input: bytes, encoding: 'utf8', windowsHide: true, maxBuffer: 16 * 1024 * 1024 })
|
|
268
275
|
if (r.status !== 0) throw new Refusal('unpack', `${pkg.name}: ${(r.stderr || r.error?.message || '').trim().split('\n').at(-1)}`)
|
|
269
|
-
rmSync(file, { force: true })
|
|
270
276
|
}
|
|
271
277
|
const pkgDir = join(partial, 'node_modules', ...parts.pkg.split('/'))
|
|
272
278
|
if (!existsSync(join(pkgDir, parts.host))) throw new Refusal('no_host', p.platform)
|
package/package.json
CHANGED