Commit graph

3 commits

Author SHA1 Message Date
23f4f1aaec feat(firstboot): unify setup import across USB and VPS 2026-06-04 20:04:22 +02:00
4c60ed81e3 fix(installer): Phase A — stable ZFS, safe upgrades, module matrix
Four critical fixes before v1.0.0 VM test, informed by PC-BSD failure
modes and GhostBSD's improvements:

1. shell-zfs.sh: zpool labelclear on fresh install
   Clear ZFS labels from every device that was in the old pool before
   bsdinstall writes new ones. Prevents the "can't find pool by GUID"
   boot failure that made PC-BSD reinstalls unreliable.

2. shell-zfs.sh: pre-upgrade snapshot
   When operator selects Upgrade, take zfs snapshot -r
   pool@pre-upgrade-{timestamp} before any changes. One reboot to
   roll back if the upgrade goes wrong. UPGRADE_SNAPSHOT exported for
   downstream modules to reference.

3. shell-env.sh: never overwrite secrets on upgrade
   clawdie_shell_env_generate() now checks CLAWDIE_BOOT_MODE. In
   upgrade mode it calls clawdie_shell_env_append_new_keys() instead
   of regenerating — reads existing .env and appends only keys that
   are absent. Existing DB passwords, JWT secrets, API keys are never
   touched. This fixes the root cause of the orphaned-database bug:
   new passwords that don't match the existing pool's data.

4. firstboot.sh: module execution matrix via run_step_if
   New run_step_if "<modes>" wrapper marks steps as done without
   running them when not applicable to the current boot mode.
   Upgrade skips: gpu, nvidia, ssh, system, desktop, pf, tailscale
   Upgrade runs: pkg, env (append-only), npm-globals, deploy
   Prevents SSH key resets, rc.conf overwrites, and firewall rewrites
   during upgrade — all of which undid operator customisations.

Also adds INSTALLER-PLAN.md: full architecture plan for unified
GUI/TUI installer with Fresh / Upgrade / Repair modes, boot
environment support, and a clear phase roadmap to v1.1.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 20:04:22 +02:00
8cc7b2dcaf Wire ZFS pool detection into firstboot pipeline (Sam & Claude)
New shell-zfs.sh module: detects existing clawdie pool, presents
boot mode menu (install/upgrade/maintenance/shell). Runs as first
step in firstboot.sh before wizard. Upgrade mode loads existing
.env and skips wizard. Maintenance mode exec's to maintenance-mode.sh.

Also: fix POSIX herestrings in maintenance-mode.sh, fix paren
mismatch in snapshot age calc, add nda (NVMe) to disk detection
patterns across all ZFS scripts for FreeBSD 15.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-04 20:04:22 +02:00