Scaffold Python orchestrator + split install.sh / finalize.sh

Chunk 1 of the C3 refactor: replace the two-pass install model (archinstall
CLI + custom shell dance + chroot bash installer) with a single Python
orchestrator that owns phase ordering, using archinstall as a library
subsystem.

Splits the bash entry point into two:
- install.sh: online entry point. Ensures omarchy runtime + base.packages
  are installed/up to date, then exec's finalize.sh.
- finalize.sh: the in-target portion (preflight + packaging + config +
  login + post-install). Called by install.sh (online) AND by the
  orchestrator after arch-chroot -u $USER (offline).

Adds the orchestrator skeleton under install/orchestrator/:
- main.py: entry point, builds + runs the phase list
- context.py: InstallContext (parsed configurator JSON + invocation paths)
- phases.py: phase state machine (logging + state.json + error wrapping)
- phases_impl.py: stubbed phase implementations (filled in by chunks 2-6)
- archinstall_adapter.py: thin compat wall around archinstall lib imports
  (only this module imports from archinstall.*)
- ui.py: gum subprocess wrappers so the orchestrator keeps the same
  styled-terminal UX as the bash installer

Updates bin/omarchy-install to dispatch:
- --config <json> in args → python -m orchestrator.main (ISO install)
- anything else → bash install.sh (online rerun on installed system)

Concrete phase logic lands in subsequent chunks. All phases currently
raise NotImplementedError; the orchestrator imports cleanly and --help
works as a smoke check.
This commit is contained in:
Ryan Hughes
2026-06-04 18:34:35 -04:00
parent d0ec7c481f
commit 2beda6abed
11 changed files with 405 additions and 23 deletions
+14 -21
View File
@@ -1,15 +1,19 @@
#!/bin/bash
#
# Online install entry point. Run by the user on an existing system to install
# / refresh Omarchy. Ensures the omarchy runtime + omarchy-base.packages set
# is up to date, then hands off to finalize.sh for the actual configure work.
#
# Offline installs (from the ISO) skip this script entirely: the Python
# orchestrator handles partitioning, base install, package install, then calls
# finalize.sh directly inside the chroot.
set -eEo pipefail
# Derive OMARCHY_PATH from the script location so install.sh works the same
# whether it's run from /usr/share/omarchy/install.sh (package mode) or
# $HOME/.local/share/omarchy/install.sh (git mode). An explicit OMARCHY_PATH
# in the caller env still wins.
_OMARCHY_INSTALLER_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
export OMARCHY_PATH="${OMARCHY_PATH:-$_OMARCHY_INSTALLER_DIR}"
export OMARCHY_INSTALL="$OMARCHY_PATH/install"
export OMARCHY_INSTALL_LOG_FILE="/var/log/omarchy-install.log"
export OMARCHY_INSTALL_LOG_FILE="${OMARCHY_INSTALL_LOG_FILE:-/var/log/omarchy-install.log}"
export PATH="$OMARCHY_PATH/bin:$PATH"
source "$OMARCHY_INSTALL/helpers/mode.sh"
@@ -18,29 +22,18 @@ export_legacy_mode_flags
source "$OMARCHY_INSTALL/helpers/all.sh"
# The install scripts assume the full Omarchy default install set is present
# (preflight guards check for limine; config scripts call omarchy-* commands;
# user scripts call apps from omarchy-base.packages; etc.).
#
# omarchy itself only hard-depends on the bricking set (~18 packages). The
# rest of the default install set lives in install/omarchy-base.packages so
# users can remove non-essential apps without pacman blocking on a depend.
#
# Online: install omarchy + everything in omarchy-base.packages now.
# Offline: the ISO pacstraps the same set before user creation; just assert.
# The finalize scripts assume the omarchy runtime + the default install set are
# already on disk. In online mode we install them here; offline mode asserts
# (the orchestrator pacstraps them before calling finalize.sh directly).
_omarchy_runtime_pkg="${OMARCHY_RUNTIME_PACKAGE:-omarchy}"
mapfile -t _omarchy_base_pkgs < <(grep -v '^#\|^$' "$OMARCHY_PATH/install/omarchy-base.packages")
if install_mode_is offline; then
pacman -Q "$_omarchy_runtime_pkg" >/dev/null 2>&1 || {
echo "Error: $_omarchy_runtime_pkg must be pacstrapped before omarchy-install runs in offline mode" >&2
echo "Error: $_omarchy_runtime_pkg must be installed before install.sh runs in offline mode" >&2
exit 1
}
else
sudo pacman -Syu --noconfirm --needed "$_omarchy_runtime_pkg" "${_omarchy_base_pkgs[@]}"
fi
source "$OMARCHY_INSTALL/preflight/all.sh"
source "$OMARCHY_INSTALL/packaging/all.sh"
source "$OMARCHY_INSTALL/config/all.sh"
source "$OMARCHY_INSTALL/login/all.sh"
source "$OMARCHY_INSTALL/post-install/all.sh"
exec bash "$OMARCHY_PATH/finalize.sh"