Files
bare-operating-system/packages/bare-os-booter/lib/archive-cli.js
T
Raven Scott d38b6eeaac feat(booter): disk.os bridge, systemctl ctx API, delegates, and docs
- Add createBareOsDiskOsBridge for Hyperdrive searchLocal + whitelisted
  bare_os.* execRpc; wire disk.os after initd
- Expose ctx.bareOsRunSystemctlCli; route /bin/systemctl and journalctl
  through it (sync seeder kernel/bin)
- Implement ssh-keygen passphrase envelope (bareOsKeySchema 2, PBKDF2 +
  ChaCha20-Poly1305); add warc and archive delegates
- Extend basenc (--base32/--base64); improve hostid/users session UX
- Introduce bare-os-boot-phases, bare-os-errors; CI boot-step alignment
- Bump BARE_OS_CTX_API_VERSION to 1.28.0; update ctx d.ts and verifiers
- Add KERNEL_CONTRACT, OTA_AND_BUNDLES, PLACEHOLDER_BASELINE; handbook
  disk.os + security hooks; reference docs and CHANGELOG
2026-04-04 18:09:08 -04:00

65 lines
1.5 KiB
JavaScript

/**
* BSD-style `archive` front-end to the stock ustar `tar` delegate (create/list/extract).
* Maps common `archive c|t|x` invocations to `tar -cf|-tf|-xf`.
*/
import { runTarCli } from './tar-cli.js'
/**
* @param {Record<string, unknown>} ctx
* @param {string[]} argv argv[0] is `archive`
*/
export async function runArchiveCli(ctx, argv) {
const args = argv.slice(1)
if (
!args.length ||
args[0] === '-h' ||
args[0] === '--help' ||
args[0] === 'help'
) {
ctx.console.log(
'usage: archive c ARCHIVE PATH [PATH...]\n' +
' archive t ARCHIVE\n' +
' archive x ARCHIVE\n' +
'Maps to ustar tar -cf / -tf / -xf (see tar --help in handbook).'
)
return
}
const op = args[0]
if (op === 'c') {
const arch = args[1]
const rest = args.slice(2)
if (!arch || !rest.length) {
ctx.console.error('archive c: need ARCHIVE and at least one PATH')
ctx.exitCode = 1
return
}
await runTarCli(ctx, ['tar', '-cf', arch, ...rest])
return
}
if (op === 't') {
const arch = args[1]
if (!arch) {
ctx.console.error('archive t: need ARCHIVE')
ctx.exitCode = 1
return
}
await runTarCli(ctx, ['tar', '-tf', arch])
return
}
if (op === 'x') {
const arch = args[1]
if (!arch) {
ctx.console.error('archive x: need ARCHIVE')
ctx.exitCode = 1
return
}
await runTarCli(ctx, ['tar', '-xf', arch])
return
}
ctx.console.error('archive: first argument must be c, t, or x')
ctx.exitCode = 1
}