forked from cflmy/deepseek-harness
Tauri's Linux deb walker drops symlinks and the pnpm node_modules tree is symlink-based, so a resource directory installed a broken tree. Ship the exact cold-install-verified .tar.gz as one resource; the shell validates entry paths, extracts once to MQDH_HOME/runtime, keeps the completed tree for later starts, and launches the same existing backend. Also fix the installer-argument parser and document TAURI.md in the product doc indexes. Verified locally in the pinned Debian 12 build image: deb bundle + extract + --version + real backend --smoke PASS.
75 lines
3.3 KiB
JavaScript
Executable File
75 lines
3.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
/**
|
|
* Attach one platform installer to the existing MQDH release manifest/evidence.
|
|
*
|
|
* The manifest keeps its single `asset` (portable archive) for the existing
|
|
* update/discovery consumers and adds an additive `installers` list describing
|
|
* official OS installers. The root release contract reads the extra assets from
|
|
* the published Release, so this is one contract, not a second version table.
|
|
*
|
|
* Usage:
|
|
* node scripts/tauri/attach-installers.mjs \
|
|
* --installer .ci/mqdh-<v>-linux-x86_64.deb --format deb --target x86_64-unknown-linux-gnu
|
|
*/
|
|
import { createHash } from 'node:crypto'
|
|
import { readFile, writeFile, stat } from 'node:fs/promises'
|
|
import { basename, join, resolve } from 'node:path'
|
|
|
|
const outDir = resolve(process.env.MARQDO_CI_OUT ?? '.ci')
|
|
const args = process.argv.slice(2)
|
|
const installers = []
|
|
for (let index = 0; index < args.length; index++) {
|
|
const flag = args[index]
|
|
const value = args[index + 1]
|
|
if (flag === '--installer') {
|
|
const path = value
|
|
const format = args[index + 2]
|
|
const target = args[index + 3]
|
|
if (path === undefined || format === undefined || target === undefined
|
|
|| format.startsWith('--') || target.startsWith('--')) {
|
|
throw new Error('usage: --installer <path> <format> <target>')
|
|
}
|
|
index += 3
|
|
installers.push({ path: resolve(path), format, target })
|
|
continue
|
|
}
|
|
if (flag === '--format' || flag === '--target' || flag === '--path') {
|
|
throw new Error('use --installer <path> <format> <target> (one triplet per installer)')
|
|
}
|
|
}
|
|
if (installers.length === 0) throw new Error('at least one --installer is required')
|
|
|
|
const manifestPath = join(outDir, 'mqdh-release.json')
|
|
const evidencePath = join(outDir, 'release-evidence.json')
|
|
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
|
|
const evidence = JSON.parse(await readFile(evidencePath, 'utf8'))
|
|
if (manifest.signature !== undefined) {
|
|
throw new Error('cannot add installers after the manifest was signed; sign once after packaging')
|
|
}
|
|
|
|
const formatInfo = {
|
|
deb: { os: 'linux', arch: 'x64', minimum_os: 'Ubuntu 24.04 / Debian 12 (glibc 2.39)' },
|
|
nsis: { os: 'windows', arch: 'x64', minimum_os: 'Windows 10 22H2 / Windows 11 x64' },
|
|
dmg: { os: 'macos', arch: 'arm64', minimum_os: 'macOS 11' },
|
|
}
|
|
const records = []
|
|
for (const item of installers) {
|
|
const info = formatInfo[item.format]
|
|
if (info === undefined) throw new Error(`unsupported installer format: ${item.format}`)
|
|
const bytes = await readFile(item.path)
|
|
const sha256 = createHash('sha256').update(bytes).digest('hex')
|
|
const size = (await stat(item.path)).size
|
|
const name = basename(item.path)
|
|
records.push({ name, size, sha256, target: item.target, ...info, format: item.format, signature: 'unsigned' })
|
|
await writeFile(join(outDir, `${name}.sha256`), `${sha256} ${name}\n`, { mode: 0o644 })
|
|
}
|
|
manifest.installers = records
|
|
await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, { mode: 0o644 })
|
|
evidence.installers = records
|
|
evidence.unverified = Array.from(new Set([
|
|
...(Array.isArray(evidence.unverified) ? evidence.unverified : []),
|
|
'installer OS signature/notarization is not configured for this build',
|
|
]))
|
|
await writeFile(evidencePath, `${JSON.stringify(evidence, null, 2)}\n`, { mode: 0o644 })
|
|
process.stdout.write(`${JSON.stringify({ installers: records }, null, 2)}\n`)
|