21 lines
660 B
JavaScript
21 lines
660 B
JavaScript
/**
|
|
* Hyperdrive-resident kernel (staged as /boot/init.js).
|
|
* Loaded by the booter with an injected ctx object (trusted replication source).
|
|
*/
|
|
async function start(ctx) {
|
|
const { console, drive, readLine, execLine, b4a } = ctx
|
|
const rel = await drive.get('/etc/os-release')
|
|
if (rel) console.log(b4a.toString(rel))
|
|
console.log(
|
|
'Bare operating system — POSIX-ish shell: cd, export, exit, quit | try: help, ls /bin, pwd'
|
|
)
|
|
while (true) {
|
|
const line = await readLine('bare-os> ')
|
|
if (line == null) break
|
|
const t = line.trim()
|
|
if (t === '') continue
|
|
const status = await execLine(t)
|
|
if (status === 'exit') break
|
|
}
|
|
}
|