Updates
This commit is contained in:
@@ -83,6 +83,7 @@ There is no arbitrary command execution, **`source`**, or control flow — it is
|
||||
- **`startBareInitd(ctx)`** — sequential start, per-service `try/catch`, `[bare-initd] name: err` on failure
|
||||
- **`registerKernelShutdownHook(fn)`** + **`runKernelShutdownHooks()`** — async-friendly teardown before disposers (REPL **`session.cleanup`** awaits hooks, then **`stopBareInitd()`**)
|
||||
- **`registerBareInitdDisposer(fn)`** + **`stopBareInitd()`** — for intervals and synchronous teardown
|
||||
- **Kernel logger** — mirrors **`console.log`/`error`** to **`~/.kernel/kernel.log`** on the personal drive; the file is **trimmed** when it grows past 512 KiB (last 256 KiB kept plus a notice line).
|
||||
|
||||
Built-in **`kernel-logger`** wraps **`ctx.console.log` / `error`** to also append UTF-8 lines to **`$HOME/.kernel/kernel.log`** (creates **`~/.kernel/.keep`** best-effort). Failures to write logs are swallowed so logging never kills the session.
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ The personal drive still persists: guest data is **not** anonymous to the drive
|
||||
- Updates **`ctx.vfs.env`** with real **`USER`**, **`HOME`** under **`/home/<pubkey-prefix>`**, **`BARE_OS_PUBLIC_KEY`**, derived **`UID`/`GID`**-like fields from a hash of the public key.
|
||||
- **`vfs.chdir`** to the new home.
|
||||
- **`onIdentityUnlocked`** (from `index.js`) activates **HDMS** with Corestore, swarm bootstrap, personal drive, mount map.
|
||||
- **`loadBarerc`** runs inside **`applyUnlockedEnv`** after a successful **`login`** or **`login --new`** (with **`createSkeletonIfMissing: true`** on first unlock), so **`~/.barerc`** exports and aliases apply immediately—custom kernels normally **do not** need to reload barerc themselves. Use **`ctx.onIdentityUnlocked`** if you want an extra banner or post-login message.
|
||||
|
||||
**`logout`** zeroes sensitive material and returns to guest; **`logout --save`** (and **`savevault`**) snapshot selected paths into **`/.bare/vault/`** as encrypted records (see `identity-account.js` helpers for AEAD and path hashing).
|
||||
|
||||
|
||||
@@ -9,8 +9,10 @@ The **kernel** is a single script. The **utilities** are many small scripts. Bot
|
||||
Staged from **`kernel/init.js`**. Responsibilities (typical):
|
||||
|
||||
1. Print **`/etc/os-release`** via **`ctx.drive.get`** + **`b4a.toString`**
|
||||
2. Print a **one-line** hint (commands, login, paths)
|
||||
3. Loop forever:
|
||||
2. Print optional **`/etc/motd`** if present
|
||||
3. Run non-comment lines from **`/etc/bare-os/rc`** through **`execLine`** (boot-time shell snippets)
|
||||
4. Print a **one-line** hint (commands, login, paths)
|
||||
5. Loop forever:
|
||||
- **`line = await readLine('')`**
|
||||
- Break on **`null`** (EOF / session end)
|
||||
- Skip empty lines
|
||||
|
||||
@@ -57,6 +57,8 @@ There is **no** **`chown`** / **`chgrp`** that changes stored ownership in a mul
|
||||
|
||||
**Unsupported:** lone **`&`** (background) is rejected with an error. There is no job control.
|
||||
|
||||
**Last exit status:** after each full **`execLine`** evaluation, **`vfs.env.BARE_OS_EXIT_STATUS`** is updated (decimal string). Words expand **`$?`** and **`${?}`** from that value (default **`0`** if unset), similar to POSIX **`$?`**.
|
||||
|
||||
Beyond **`alias`**, **`unalias`**, **`cd`**, **`export`**, **`login`**, **`logout`**, **`exit`**:
|
||||
|
||||
| Builtin | Behavior |
|
||||
|
||||
Reference in New Issue
Block a user