This commit is contained in:
Raven Scott
2026-04-03 18:02:17 -04:00
parent 24d221209c
commit ef9ef9058f
+33 -1
View File
@@ -2,12 +2,44 @@
* Hyperdrive-resident kernel (staged as /boot/init.js).
* Loaded by the booter with an injected ctx object (trusted replication source).
*/
/**
* Print /etc/motd and run /etc/bare-os/rc lines (comments and blank lines skipped).
* @param {Record<string, unknown>} ctx
*/
async function runEtcSnippets(ctx) {
const { drive, execLine, b4a, console } = ctx
try {
const motd = await drive.get('/etc/motd')
if (motd) console.log(b4a.toString(motd).trimEnd())
} catch (e) {
console.error((e && e.message) || String(e))
}
try {
const rc = await drive.get('/etc/bare-os/rc')
if (!rc) return
const text = b4a.toString(rc)
for (const line of text.split(/\r?\n/)) {
const t = line.trim()
if (!t || t.startsWith('#')) continue
try {
await execLine(t)
} catch (e) {
console.error((e && e.message) || String(e))
}
}
} catch (e) {
console.error((e && e.message) || String(e))
}
}
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))
await runEtcSnippets(ctx)
console.log(
'Bare operating system — session: guest (login [--new] <passphrase> to unlock identity) | shell: cd, export, exit, login, logout | try: help, ls /bin, pwd, crontab -l'
'Bare operating system — session: guest (login [--new] <passphrase> to unlock identity) | shell: cd, export, && || ;, exit, login, logout | try: help, getconf PATH_MAX, ls /bin, pwd, crontab -l'
)
while (true) {
const line = await readLine('')