55 lines
3.1 KiB
Markdown
55 lines
3.1 KiB
Markdown
# bare-os-seeder
|
||
|
||
**Pear / Bare application** that owns the **canonical system Hyperdrive**: it walks a kernel tree on disk, writes `/boot/init.js`, `/bin/*`, `/etc/*` into the drive (no host temp dirs), builds a **512-byte MBR** with the drive key, joins **Hyperswarm** on `bare-os-v1`, and serves MBR block reads + **Protomux** `bare-os-v1` replication to peers.
|
||
|
||
## Run
|
||
|
||
From package directory (after `npm ci` at repo root):
|
||
|
||
```bash
|
||
node index.js
|
||
```
|
||
|
||
Or with Bare/Pear:
|
||
|
||
```bash
|
||
npm run pear:dev
|
||
```
|
||
|
||
From **repo root** (recommended — fixes workspace `node_modules` for Pear):
|
||
|
||
```bash
|
||
npm run os:seeder
|
||
```
|
||
|
||
## Environment
|
||
|
||
| Variable | Meaning |
|
||
| --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||
| `BARE_OS_KERNEL_ROOT` | Absolute path to kernel tree to stage (default: package `kernel/` vendored copy, or repo `kernel/` under Node `file:` URL) |
|
||
| `BARE_OS_HOST_DATA` | Base directory for host state (default `~/.bare-os`) |
|
||
| `BARE_OS_SEED_STORE` | Corestore directory (default `~/.bare-os/corestore/seeder`) |
|
||
|
||
## Pear vs Node
|
||
|
||
- **`import.meta.url` is `file:`** — seeder may **dynamically import** `bare-os-coreutils/build.mjs` and **`bare-os-bare-libs/build.mjs`**, rebuilding `/bin` and **`kernel/lib/bare`** before staging.
|
||
- **`pear:` bundle** — coreutils and **`/lib/bare`** bundles must be **pre-built** into `kernel/`; run `npm run build -w bare-os-coreutils` and `npm run build -w bare-os-bare-libs` before `pear run` (root **`npm run os:seeder`** does both).
|
||
|
||
## Layout
|
||
|
||
| Path | Role |
|
||
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||
| `index.js` | Entry: Corestore, Hyperdrive, `stageKernelTree`, swarm, `setupSeedChannel` |
|
||
| `lib/paths.js` | `packageRootDir`, kernel root, Corestore path (Pear RTI–aware) |
|
||
| `kernel/` | Vendored mirror of repo `kernel/` for Pear staging — must match **`kernel/`** byte-for-byte (`npm test` **`pretest`** runs `scripts/verify-kernel-seeder-parity.mjs`) |
|
||
|
||
## Dependencies
|
||
|
||
`bare-os-protocol` (workspace), `hyperdrive`, `corestore`, `hyperswarm`, `protomux`, `b4a`, `compact-encoding`, `safety-catch`, `bare-os`.
|
||
|
||
## See also
|
||
|
||
- [bare-os-protocol](../bare-os-protocol/README.md)
|
||
- [Handbook — Seeder path](../../handbook/03-protocol-and-disk.md#seeder-lifecycle)
|
||
- Root [README.md](../../README.md)
|