updates
This commit is contained in:
@@ -43,9 +43,9 @@ The following are set on `ctx` before the kernel starts (unless noted as overwri
|
||||
| **`applyUnlock` / `applyRegister` / `applyLogin` / `applyLogout` / `saveVault`** | Identity and vault operations used by **`login`**, **`logout`**, **`savevault`** |
|
||||
| **`shellAliases`** | Populated when the shell loads default or `~/.barerc` aliases |
|
||||
| **`runBinCommand(argv)`** | Runs a command with the **same** resolution rules as the interactive shell (used by **`time`**, **`xargs`**, and similar) |
|
||||
| **`registerKernelShutdownHook(fn)`** | Register an async or sync function to run when the REPL session ends, **before** initd disposers (`clearInterval`, …). See [`bare-initd.js`](../packages/bare-os-booter/lib/bare-initd.js) |
|
||||
| **`registerKernelShutdownHook(fn)`** | Register an async or sync function to run when the REPL session ends, **before** **`stopBareInitd`** and initd **disposers**. Pair with **`registerBareInitdDisposer(fn)`** in [`bare-initd.js`](../packages/bare-os-booter/lib/bare-initd.js) when you need teardown **after** shutdown hooks but still inside **`stopBareInitd`** (intervals, sync cleanup). |
|
||||
|
||||
Kernel boot composition lives on the **system image** (`/boot/init.js`, `/etc/bare-os/rc`, `/etc/bare-os/rc.d/`, optional **`/etc/bare-os/rc.local`**, optional **`/etc/bare-os/profile`** / **`rc.profile.*`**, **`/etc/bare-os/onboot`**), not on `ctx`—extend the image or hooks like `registerKernelShutdownHook` rather than adding boot fields to the context object. The booter seeds **`ctx.env`** from the host for **`BARE_OS_PIPELINE_MAX_STAGES`**, **`BARE_OS_PIPELINE_MAX_BYTES`**, **`BARE_OS_PIPELINE_MAX_LINES`**, **`BARE_OS_BOOT_PROFILE`**, and **`BARE_OS_ONBOOT`** when those variables are set (automation / tuning).
|
||||
Kernel boot composition lives on the **system image** (`/boot/init.js`, `/etc/bare-os/rc`, `/etc/bare-os/rc.d/`, optional **`/etc/bare-os/rc.local`**, optional **`/etc/bare-os/kernel.d/`** (same digit-prefix rules as **`rc.d`**), optional **`/etc/bare-os/profile`** / **`rc.profile.*`**, **`/etc/bare-os/onboot`**), not on `ctx`—extend the image or hooks like **`registerKernelShutdownHook`** rather than adding boot fields to the context object. The booter seeds **`ctx.env`** from the host for **`BARE_OS_PIPELINE_MAX_STAGES`**, **`BARE_OS_PIPELINE_MAX_BYTES`**, **`BARE_OS_PIPELINE_MAX_LINES`**, **`BARE_OS_BOOT_PROFILE`**, and **`BARE_OS_ONBOOT`** when those variables are set, and always sets **`BARE_OS_BOOT_PROFILE_RESOLVED`** to the profile name used for **`rc.profile.*`** and the synthetic **`/run/bare-os/boot_profile`** file (host override or first line of **`/etc/bare-os/profile`** on the system drive, possibly empty).
|
||||
|
||||
After [`createKernelReplSession`](../packages/bare-os-booter/lib/repl-session.js) returns:
|
||||
|
||||
@@ -59,10 +59,10 @@ After [`createKernelReplSession`](../packages/bare-os-booter/lib/repl-session.js
|
||||
|
||||
When the shell runs an external command (or a pipeline stage), it may pass a **shallow clone** of `ctx` with extra fields:
|
||||
|
||||
| Field | When |
|
||||
| ---------------- | -------------------------------------------------------------------------------------------------------------- | --- | ---------------------------------------------------------------------------------- |
|
||||
| **`shellStdin`** | String body for simulated stdin (pipelines and `<` redirection) |
|
||||
| **`exitCode`** | Utilities set `ctx.exitCode` for conditions (**`test`**, **`grep`**, …); the shell uses it for **`&&`**, \*\*` | | `**, and **`;`** lists (see [`shell.js`](../packages/bare-os-booter/lib/shell.js)) |
|
||||
| Field | When |
|
||||
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **`shellStdin`** | String body for simulated stdin (pipelines and `<` redirection) |
|
||||
| **`exitCode`** | Utilities set **`ctx.exitCode`** for conditions (**`test`**, **`grep`**, …); the shell uses it for **`&&`**, logical OR lists, and **`;`** sequencing (see [`shell.js`](../packages/bare-os-booter/lib/shell.js)) |
|
||||
|
||||
Always use the `ctx` passed into **`run`**, not a global, so pipeline stdin works.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user