Complete the internal “100 task” roadmap: coreutils and shell parity (xargs,
sh, diff/patch, sort, printf, find, test, getfacl/setfacl/xattr), expanded /proc and metrics (process table, syscalls, replication, net, security posture, worker budget, swarm/replication hints), initd DAG supervision metadata and richer restart journal telemetry, synthetic process groups via IPC (assignProcessGroup/signalProcessGroup) mirrored into process_table, optional kernel.ext.d incremental hot reload (BARE_OS_KERNEL_EXT_D_HOT_RELOAD) with reload audit NDJSON, features proc for hyperblobs dedup and systemd subset documentation, vault threat model doc plus posture fields for AEAD, Pear enclave pointer, account rotation continuity, and Ed25519 consistency across boot manifest / extensions / replication. Adds or extends tests and keeps kernel/ and packages/bare-os-seeder/kernel/ in parity; guest init is bundled from kernel/lib/init/init-main.js via bundle-kernel-init.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
async function run(ctx, argv) {
|
||||
const script = argv[1]
|
||||
if (script == null) {
|
||||
ctx.console.error('usage: sh SCRIPT')
|
||||
ctx.exitCode = 2
|
||||
return
|
||||
}
|
||||
if (typeof ctx.execLine !== 'function') {
|
||||
ctx.console.error('sh: execLine is not available (requires a Bare OS booter session)')
|
||||
ctx.exitCode = 1
|
||||
return
|
||||
}
|
||||
let buf
|
||||
try {
|
||||
buf = await ctx.vfs.readFile(script)
|
||||
} catch (e) {
|
||||
ctx.console.error('sh: ' + ((e && e.message) || String(e)))
|
||||
ctx.exitCode = 1
|
||||
return
|
||||
}
|
||||
if (buf == null) {
|
||||
ctx.console.error('sh: ' + script + ': not found')
|
||||
ctx.exitCode = 127
|
||||
return
|
||||
}
|
||||
let text = ctx.b4a.toString(buf)
|
||||
if (text.charCodeAt(0) === 0xfeff) text = text.slice(1)
|
||||
text = text.replace(/^\ufeff/, '')
|
||||
if (text.startsWith('#!')) {
|
||||
const nl = text.indexOf('\n')
|
||||
text = nl === -1 ? '' : text.slice(nl + 1)
|
||||
}
|
||||
const lines = text.split(/\r?\n/)
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const trimmed = lines[i].trim()
|
||||
if (!trimmed || trimmed.startsWith('#')) continue
|
||||
await ctx.execLine(trimmed)
|
||||
if ((Number(ctx.exitCode) || 0) !== 0) return
|
||||
}
|
||||
ctx.exitCode = 0
|
||||
}
|
||||
Reference in New Issue
Block a user