feat(main): integrate new modules and remove installer phase

Remove dependency on void-installer by integrating new modules:
- Source packages.sh, locale.sh, users.sh, services.sh
- Remove installer.sh sourcing
- Add 4 new phases after mounts: packages, locale, users, services
- Remove run_installer() phase
- Remove SKIP_INSTALLER flag and --skip-installer option

Decision: Execute new phases in logical order.
Packages must install before locale (needs glibc-locales package).
Locale before users (user shell may depend on locale).
Users before services (services may need user context).

Workflow change:
Before: Mounts → void-installer (manual) → Post-Install
After:  Mounts → Packages → Locale → Users → Services → Post-Install

Alternative considered: Keep installer.sh as optional fallback
rejected. Clean break eliminates maintenance burden and reduces
complexity. Users who need custom package selection can modify
packages.sh directly.

Trade-off: Removes flexibility of void-installer's package
selection UI. Accepted because:
1. Requirements explicitly exclude GUI/TUI components
2. Config file support (future) will provide customization
3. Simpler codebase easier to maintain and debug

Module sourcing order preserves dependency chain:
logging → config → sanity → disk ops → installation → rollback
This commit is contained in:
Stefan Strobl 2025-12-24 20:45:07 +01:00
parent 0913adf00e
commit b2031eae4b
2 changed files with 15 additions and 81 deletions

View File

@ -1,71 +0,0 @@
#!/usr/bin/env bash
# === Motivation ===
# Keep the official installer as the configuration authority.
# === Problem Statement ===
# We need a clean handoff so the installer uses existing mounts without reformatting.
# === Scope ===
# In scope: instructions and guardrails for the user during the installer run.
# Out of scope: automated installer configuration.
# === Concepts ===
# Handoff: a pause where the wrapper delegates to the installer.
# === Decisions ===
# Provide clear, minimal guidance to avoid overriding prepared filesystems.
# Support only CLI installer flow to keep guidance consistent.
# === Alternatives Considered ===
# Fully scripted installation rejected for this phase.
# === Constraints ===
# The wrapper must not hide or alter installer behavior.
# === Open Questions ===
# Should we provide a checklist or step-by-step guide during the installer handoff?
# How do we detect if the installer reformatted filesystems against our intent?
# Should we monitor the installer process, or fully delegate control?
# === Success Criteria ===
# The installer completes using the prepared mounts without reformatting.
run_installer() {
: "${MOUNT_ROOT:?Mount root is required}"
: "${ESP_MOUNT:?ESP mount path is required}"
if ! findmnt "$MOUNT_ROOT" >/dev/null 2>&1; then
die "Mount root not found: $MOUNT_ROOT"
fi
if ! findmnt "$ESP_MOUNT" >/dev/null 2>&1; then
die "ESP mount not found: $ESP_MOUNT"
fi
log_info "Installer handoff: use the prepared mounts without formatting."
log_info "In the installer: choose manual partitioning and only set mountpoints."
if [[ "${SKIP_INSTALLER:-0}" -eq 1 ]]; then
log_warn "Skipping installer per request."
return 0
fi
read -r -p "Press Enter to launch void-installer..." _
if command -v void-installer >/dev/null 2>&1; then
void-installer
else
log_warn "void-installer not found. Run it manually in another shell."
fi
read -r -p "Press Enter once the installer is complete..." _
# Verify critical mounts are still intact after installer
if ! findmnt "$MOUNT_ROOT" >/dev/null 2>&1; then
die "Root mount disappeared after installer. The installer may have reformatted the filesystem."
fi
if ! findmnt "$ESP_MOUNT" >/dev/null 2>&1; then
die "ESP mount disappeared after installer. The installer may have reformatted the filesystem."
fi
log_info "Mount verification passed."
}

View File

@ -72,23 +72,27 @@ source "$SCRIPT_DIR/encryption.sh"
source "$SCRIPT_DIR/filesystems.sh" source "$SCRIPT_DIR/filesystems.sh"
# shellcheck source=src/mounts.sh # shellcheck source=src/mounts.sh
source "$SCRIPT_DIR/mounts.sh" source "$SCRIPT_DIR/mounts.sh"
# shellcheck source=src/installer.sh # shellcheck source=src/packages.sh
source "$SCRIPT_DIR/installer.sh" source "$SCRIPT_DIR/packages.sh"
# shellcheck source=src/locale.sh
source "$SCRIPT_DIR/locale.sh"
# shellcheck source=src/users.sh
source "$SCRIPT_DIR/users.sh"
# shellcheck source=src/services.sh
source "$SCRIPT_DIR/services.sh"
# shellcheck source=src/postinstall.sh # shellcheck source=src/postinstall.sh
source "$SCRIPT_DIR/postinstall.sh" source "$SCRIPT_DIR/postinstall.sh"
# shellcheck source=src/rollback.sh # shellcheck source=src/rollback.sh
source "$SCRIPT_DIR/rollback.sh" source "$SCRIPT_DIR/rollback.sh"
DRY_RUN=0 DRY_RUN=0
SKIP_INSTALLER=0
CURRENT_PHASE="" CURRENT_PHASE=""
usage() { usage() {
cat <<USAGE cat <<USAGE
Usage: ./main.sh [--dry-run] [--skip-installer] Usage: ./main.sh [--dry-run]
--dry-run Print configuration summary and exit --dry-run Print configuration summary and exit
--skip-installer Skip launching void-installer (manual run)
USAGE USAGE
} }
@ -98,9 +102,6 @@ parse_args() {
--dry-run) --dry-run)
DRY_RUN=1 DRY_RUN=1
;; ;;
--skip-installer)
SKIP_INSTALLER=1
;;
-h|--help) -h|--help)
usage usage
exit 0 exit 0
@ -153,10 +154,14 @@ main() {
run_phase "encryption" encrypt_root run_phase "encryption" encrypt_root
run_phase "filesystems" format_filesystems run_phase "filesystems" format_filesystems
run_phase "mounts" mount_filesystems run_phase "mounts" mount_filesystems
run_phase "installer" run_installer run_phase "packages" packages_install
run_phase "locale" locale_configure
run_phase "users" users_setup
run_phase "services" services_configure
run_phase "post-install" postinstall_run run_phase "post-install" postinstall_run
log_info "Installation wrapper completed." log_info "Installation completed successfully."
log_info "System is ready to boot."
log_info "Log file: ${LOG_FILE}" log_info "Log file: ${LOG_FILE}"
} }