Unify ISO install orchestration

Drive installs through the common ISO pipeline, carry install intent in configurator JSON, and finalize Limine boot setup from the ISO.
This commit is contained in:
Ryan Hughes committed 2026-05-25 12:50:31 -04:00
1 parent 660edcb3af
commit c50d0bc299
17 files changed
+958 -814

No files matched your search

@@ -0,0 +1,21 @@
# remove from airootfs!
#
# Mirror omarchy-settings' /etc/skel shell defaults into /root so the live ISO
# console has the same bashrc, starship prompt, and aliases as an installed
# Omarchy system. Fires during airootfs pacstrap (when omarchy-settings is
# installed); the "remove from airootfs" magic string causes
# zzzz99-remove-custom-hooks-from-airootfs.hook to delete this file before
# the squashfs is built, so no runtime hook remains.
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = omarchy-settings
[Action]
Description = Mirroring /etc/skel shell defaults into /root for the live ISO...
When = PostTransaction
Depends = coreutils
Depends = omarchy-settings
Exec = /bin/sh -c 'install -d -m 0700 /root/.config && for f in .bashrc .bash_profile; do [ -f "/etc/skel/$f" ] && install -m 0644 "/etc/skel/$f" "/root/$f"; done; [ -f /etc/skel/.config/starship.toml ] && install -m 0644 /etc/skel/.config/starship.toml /root/.config/starship.toml; true'
+1 -2
View File
@@ -19,7 +19,6 @@ export OMARCHY_INSTALL_LOG_FILE=/var/log/omarchy-install.log
if [[ -f /usr/share/omarchy-iso/install-debug ]]; then
export OMARCHY_INSTALL_DEBUG=1
fi
source "$OMARCHY_INSTALL/helpers/all.sh"
# Tokyo Night palette so the live VT matches the installed look.
set_tokyo_night_colors() {
@@ -46,7 +45,7 @@ export FORCE_COLOR=1
if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
echo "=== Omarchy ISO debug build ==="
[[ -f /usr/share/omarchy-iso/build-info ]] && cat /usr/share/omarchy-iso/build-info
pacman -Q omarchy-installer omarchy-settings omarchy-keyring 2>/dev/null || true
pacman -Q omarchy-settings omarchy-keyring 2>/dev/null || true
echo "================================"
fi
+307 -102
View File
@@ -1,7 +1,54 @@
#!/bin/bash
# Rely on Omarchy for styling and error handling
source "$OMARCHY_INSTALL/helpers/all.sh"
# Minimal live-ISO presentation helpers. Keep these local to the ISO: the
# installed Omarchy package owns target setup helpers, while the ISO owns the
# installer UI that runs before any target packages exist.
OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
LOGO_PATH="${LOGO_PATH:-$OMARCHY_PATH/logo.txt}"
if [[ -e /dev/tty ]]; then
TERM_SIZE=$(stty size 2>/dev/null </dev/tty || true)
fi
if [[ -n ${TERM_SIZE:-} ]]; then
TERM_HEIGHT=${TERM_SIZE%% *}
TERM_WIDTH=${TERM_SIZE##* }
else
TERM_HEIGHT=${LINES:-24}
TERM_WIDTH=${COLUMNS:-80}
fi
if [[ -f $LOGO_PATH ]]; then
LOGO_WIDTH=$(awk '{ if (length > max) max = length } END { print max+0 }' "$LOGO_PATH" 2>/dev/null || echo 0)
else
LOGO_WIDTH=7
fi
(( LOGO_WIDTH > 0 )) || LOGO_WIDTH=7
PADDING_LEFT=$(((TERM_WIDTH - LOGO_WIDTH) / 2))
(( PADDING_LEFT < 0 )) && PADDING_LEFT=0
PADDING_LEFT_SPACES=$(printf "%*s" "$PADDING_LEFT" "")
PADDING="0 0 0 $PADDING_LEFT"
export TERM_HEIGHT TERM_WIDTH LOGO_PATH PADDING_LEFT PADDING_LEFT_SPACES PADDING
export GUM_CONFIRM_PROMPT_FOREGROUND="6"
export GUM_CONFIRM_SELECTED_FOREGROUND="0"
export GUM_CONFIRM_SELECTED_BACKGROUND="2"
export GUM_CONFIRM_UNSELECTED_FOREGROUND="7"
export GUM_CONFIRM_UNSELECTED_BACKGROUND="0"
export GUM_CHOOSE_PADDING="$PADDING"
export GUM_FILTER_PADDING="$PADDING"
export GUM_INPUT_PADDING="$PADDING"
export GUM_SPIN_PADDING="$PADDING"
export GUM_TABLE_PADDING="$PADDING"
export GUM_CONFIRM_PADDING="$PADDING"
clear_logo() {
printf "\033[H\033[2J"
if [[ -f $LOGO_PATH ]]; then
gum style --foreground 2 --padding "1 0 0 $PADDING_LEFT" "$(<"$LOGO_PATH")"
else
gum style --foreground 2 --padding "1 0 0 $PADDING_LEFT" "Omarchy"
fi
}
# Ensure tzupdate is available for guessing timezone
command -v tzupdate >/dev/null || sudo pacman -Sy --noconfirm tzupdate
@@ -16,10 +63,15 @@ abort() {
step() {
clear_logo
echo
gum style "$1"
gum style --padding "0 0 0 $PADDING_LEFT" "$1"
echo
}
# Padded body text to line up with the logo and gum widgets.
say() {
gum style --padding "0 0 0 $PADDING_LEFT" "$@"
}
notice() {
clear_logo
echo
@@ -27,6 +79,76 @@ notice() {
echo
}
# Tools menu — recovery-style actions kept off the main install path.
# Inlines its own disk picker so the launcher can run before disk_form is
# defined further down in the script.
tools_menu() {
while true; do
step "Tools"
local choice
choice=$(gum choose --header "Pick a tool" \
"Open partition tool" \
"Drop to shell" \
"Reboot" \
"Power off" \
"Back to installer") || return 0
case "$choice" in
"Open partition tool")
local d disks
disks=$(lsblk -dpno NAME,TYPE 2>/dev/null | awk '$2=="disk"{print $1}' | grep -E '/dev/(sd|hd|vd|nvme|mmcblk|xv)' || true)
if [[ -z "$disks" ]]; then
notice "No suitable disks found" 2
continue
fi
d=$(echo "$disks" | gum choose --header "Select disk") || continue
clear
cfdisk "$d" || true
partprobe "$d" 2>/dev/null || true
sync
sleep 1
;;
"Drop to shell")
clear
echo "Type 'exit' to return to the tools menu."
bash --norc || true
;;
"Reboot")
reboot
;;
"Power off")
poweroff
;;
"Back to installer")
return 0
;;
esac
done
}
# Landing screen: Enter installs, Ctrl-T opens the tools menu.
launcher_form() {
while true; do
step "Install Omarchy"
say "Press Enter to install Omarchy on this machine."
echo
say --foreground 8 "Ctrl-T Tools"
local key
IFS= read -rsn1 key || true
case "$key" in
""|$'\n'|$'\r')
return 0
;;
$'\x14')
tools_menu
;;
esac
done
}
launcher_form
# STEP 1: KEYBOARD LAYOUT
keyboard_form() {
@@ -280,6 +402,21 @@ to_gb() {
awk -v bytes="$1" 'BEGIN {printf "%.1fGB", bytes/1024/1024/1024}'
}
# Shared error screen for every "can't fit Omarchy here" outcome of the
# partition install. Offers the partition tool as the meaningful second
# action so users have a way to actually fix the situation.
not_enough_space() {
local available="${1:-0}"
step "Not enough free space on $disk"
say --foreground 1 "$disk has $(to_gb $available) of usable free space; Omarchy needs at least 32GB."
say "Open the partition tool to free at least 32GB on $disk, then try again."
echo
if ! gum confirm --affirmative "Back" --negative "Open partition tool" "Return to installation mode?"; then
open_partition_tool
fi
return 1
}
run_partition_install() {
local dry=false
[[ "${1:-}" == "dry" ]] && dry=true
@@ -288,8 +425,8 @@ run_partition_install() {
local bl_part
bl_part=$(detect_bitlocker || true)
if [[ -n "$bl_part" ]]; then
gum style --foreground 1 "BitLocker signature detected on $bl_part."
gum style "Suspend or disable BitLocker in Windows before installing alongside it."
say --foreground 1 "BitLocker signature detected on $bl_part."
say "Suspend or disable BitLocker in Windows before installing alongside it."
abort "Aborted: BitLocker is active on this disk."
fi
@@ -298,7 +435,7 @@ run_partition_install() {
shared_esp=$(detect_windows_esp || true)
if [[ -n "$shared_esp" ]]; then
gum style "Found Windows ESP at $shared_esp — will install alongside."
say "Found Windows ESP at $shared_esp — will install alongside."
local tmp_mp esp_free_mib
tmp_mp=$(mktemp -d)
mount -o ro "$shared_esp" "$tmp_mp"
@@ -307,39 +444,50 @@ run_partition_install() {
if (( esp_free_mib < 100 )); then
abort "Windows ESP $shared_esp has only ${esp_free_mib}MiB free — need at least 100MiB for Omarchy."
fi
gum style "Windows ESP has ${esp_free_mib}MiB free."
say "Windows ESP has ${esp_free_mib}MiB free."
else
gum style "No Windows ESP detected on $disk — a new EFI partition will be created in free space."
say "No Windows ESP detected on $disk — a new EFI partition will be created in free space."
fi
step "Analyzing free space on $disk"
partprobe "$disk" 2>/dev/null || true
sleep 1
parted --script "$disk" unit B print free 2>/dev/null || lsblk -b "$disk"
echo
local FREE_SPACE_INFO
FREE_SPACE_INFO=$(parted -m "$disk" unit B print free 2>/dev/null | \
awk -F: '
$NF ~ /free/ {
start=$2; end=$3; size=$4;
gsub(/B/, "", start);
gsub(/B/, "", end);
gsub(/B/, "", size);
if (size+0 > max_size+0) {
max_size=size; max_start=start; max_end=end;
# An unlabeled disk has no partition table for parted to scan, so we
# synthesize a whole-disk free region and mklabel gpt before mkpart.
local FREE_SPACE_INFO needs_mklabel=false pt_type disk_size_b
pt_type=$(lsblk -dno PTTYPE "$disk" 2>/dev/null)
if [[ -z "$pt_type" ]]; then
disk_size_b=$(lsblk -bdno SIZE "$disk" 2>/dev/null)
if [[ -n "$disk_size_b" && "$disk_size_b" -gt 0 ]]; then
local _mib=$((1024 * 1024))
local _start=$_mib
local _end=$(( (disk_size_b - _mib) / _mib * _mib ))
FREE_SPACE_INFO="$_start $_end $((_end - _start))"
needs_mklabel=true
fi
else
# -s (script mode) keeps parted from prompting on stderr for warnings
# like a stale GPT backup; without it the configurator hangs invisibly.
FREE_SPACE_INFO=$(parted -ms "$disk" unit B print free </dev/null 2>/dev/null | \
awk -F: '
$NF ~ /free/ {
start=$2; end=$3; size=$4;
gsub(/B/, "", start);
gsub(/B/, "", end);
gsub(/B/, "", size);
if (size+0 > max_size+0) {
max_size=size; max_start=start; max_end=end;
}
}
}
END {
if (max_size+0 > 0) printf "%s %s %s\n", max_start, max_end, max_size;
}')
END {
if (max_size+0 > 0) printf "%s %s %s\n", max_start, max_end, max_size;
}')
fi
if [[ -z "$FREE_SPACE_INFO" ]]; then
gum style --foreground 1 "No usable free space detected on $disk."
gum style "Partition install uses unallocated free space, not a pre-created partition."
gum style "Open the partition tool, delete/shrink partitions until the target area says Free space, then leave it unallocated."
gum confirm --affirmative "Back" --negative "Back" "Return to installation mode?" >/dev/null 2>&1 || true
return 1
not_enough_space 0
return $?
fi
local FREE_START_B FREE_END_B FREE_SIZE_B
@@ -363,9 +511,8 @@ run_partition_install() {
ROOT_END_B=$((FREE_END_B / ALIGN * ALIGN))
if (( ROOT_END_B <= ROOT_START_B )); then
gum style --foreground 1 "Not enough aligned free space for partitions after alignment."
gum confirm --affirmative "Back" --negative "Back" "Return to installation mode?" >/dev/null 2>&1 || true
return 1
not_enough_space "$FREE_SIZE_B"
return $?
fi
local INSTALL_START_B INSTALL_MAX_B INSTALL_MAX_GIB INSTALL_SIZE_GIB
@@ -377,22 +524,20 @@ run_partition_install() {
INSTALL_MAX_B=$((ROOT_END_B - INSTALL_START_B))
if (( INSTALL_MAX_B < MIN_INSTALL_B )); then
gum style --foreground 1 "Usable free space ($(to_gb $INSTALL_MAX_B)) is below the 32GB minimum for Omarchy."
gum style "Open the partition tool, delete/shrink partitions until the target area says Free space, then leave it unallocated."
gum confirm --affirmative "Back" --negative "Back" "Return to installation mode?" >/dev/null 2>&1 || true
return 1
not_enough_space "$INSTALL_MAX_B"
return $?
fi
INSTALL_MAX_GIB=$((INSTALL_MAX_B / gib))
while true; do
step "Choose Omarchy size"
gum style "Free region: $(to_gb $FREE_START_B) — $(to_gb $FREE_END_B) ($(to_gb $FREE_SIZE_B))"
say "Free region: $(to_gb $FREE_START_B) — $(to_gb $FREE_END_B) ($(to_gb $FREE_SIZE_B))"
if [[ -z "$shared_esp" ]]; then
gum style "The size includes a new 2GiB EFI partition; the rest becomes root."
say "The size includes a new 2GiB EFI partition; the rest becomes root."
else
gum style "Using existing ESP: $shared_esp"
say "Using existing ESP: $shared_esp"
fi
gum style "Omarchy can use 32–${INSTALL_MAX_GIB}GiB total. Leave the default to use all available space."
say "Omarchy can use 32–${INSTALL_MAX_GIB}GiB total. Leave the default to use all available space."
echo
INSTALL_SIZE_GIB=$(gum input \
@@ -414,32 +559,61 @@ run_partition_install() {
ROOT_END_B=$((ROOT_START_B + INSTALL_SIZE_GIB * gib))
fi
step "Proposed layout on $disk"
gum style "Free region: $(to_gb $FREE_START_B) — $(to_gb $FREE_END_B) ($(to_gb $FREE_SIZE_B))"
if [[ -z "$shared_esp" ]]; then
gum style " New EFI partition: $(to_gb $EFI_START_B) — $(to_gb $EFI_END_B) (2GB FAT32)"
else
gum style " Shared ESP: $shared_esp (Windows, mounted at /efi)"
fi
gum style " New root (Btrfs): $(to_gb $ROOT_START_B) — $(to_gb $ROOT_END_B) ($(to_gb $((ROOT_END_B - ROOT_START_B))))"
echo
# Shared Windows ESP can't host our LUKS layout, so encryption isn't
# offered in that case. Otherwise default to encrypted and hide the
# unencrypted path behind Ctrl+C, matching the full-disk flow.
local mode="encrypted" affirmative confirm_status
[[ -n "$shared_esp" ]] && mode="forced_unencrypted"
gum confirm --affirmative "Yes, partition" --negative "Cancel" \
"Create Omarchy partitions in the free space on $disk?" || return 1
while true; do
step "Proposed layout on $disk"
say "Free region: $(to_gb $FREE_START_B) — $(to_gb $FREE_END_B) ($(to_gb $FREE_SIZE_B))"
if [[ -z "$shared_esp" ]]; then
say " New EFI partition: $(to_gb $EFI_START_B) — $(to_gb $EFI_END_B) (2GB FAT32)"
else
say " Shared ESP: $shared_esp (Windows, mounted at /efi)"
fi
say " New root (Btrfs): $(to_gb $ROOT_START_B) — $(to_gb $ROOT_END_B) ($(to_gb $((ROOT_END_B - ROOT_START_B))))"
echo
echo
if gum confirm \
--affirmative "Yes, encrypt" \
--negative "No, leave unencrypted" \
"Encrypt the Omarchy root partition with LUKS2?"; then
encrypt_installation=true
else
encrypt_installation=false
fi
case $mode in
encrypted)
say --foreground 8 "Press Ctrl+C for unencrypted install."
affirmative="Yes, install"
;;
unencrypted)
affirmative="Yes, install without encryption"
;;
forced_unencrypted)
say --foreground 8 "Shared Windows ESP cannot host encrypted Omarchy — installing unencrypted."
affirmative="Yes, install"
;;
esac
echo
if [[ "$encrypt_installation" == "true" && -n "$shared_esp" ]]; then
abort "Encrypted install on a shared Windows ESP is not yet supported. Please choose unencrypted, or use Full Install."
fi
gum confirm --affirmative "$affirmative" --negative "Cancel" \
"Create Omarchy partitions in the free space on $disk?"
confirm_status=$?
case $confirm_status in
0)
[[ $mode == "encrypted" ]] && encrypt_installation=true || encrypt_installation=false
break
;;
1)
return 1
;;
130)
case $mode in
encrypted) mode="unencrypted" ;;
unencrypted) mode="encrypted" ;;
esac
;;
*)
abort
;;
esac
done
local esp_mount_in_target
if [[ "$encrypt_installation" == "true" ]]; then
@@ -465,20 +639,31 @@ run_partition_install() {
root_part_num=$(( ${last_part:-0} + 1 ))
fi
local efi_dev root_partition_device
local efi_dev root_partition_device root_mapper
if [[ -n "$shared_esp" ]]; then
efi_dev="$shared_esp"
else
efi_dev=$(partition_path "$disk" "$efi_part_num")
fi
root_partition_device=$(partition_path "$disk" "$root_part_num")
if [[ "$encrypt_installation" == "true" ]]; then
root_mapper="/dev/mapper/omarchy_root"
else
root_mapper="$root_partition_device"
fi
if $dry; then
gum style "[dry] would create root partition at $root_partition_device"
[[ -z "$shared_esp" ]] && gum style "[dry] would create EFI partition at $efi_dev"
gum style "[dry] encrypted=$encrypt_installation kernel=$kernel_choice"
$needs_mklabel && say "[dry] would initialize GPT on $disk"
say "[dry] would create root partition at $root_partition_device"
[[ -z "$shared_esp" ]] && say "[dry] would create EFI partition at $efi_dev"
say "[dry] encrypted=$encrypt_installation kernel=$kernel_choice"
else
step "Creating partitions on $disk"
if $needs_mklabel; then
parted --script "$disk" mklabel gpt
partprobe "$disk" 2>/dev/null || true
sleep 1
fi
if [[ -z "$shared_esp" ]]; then
parted --script "$disk" mkpart primary fat32 "${EFI_START_B}B" "${EFI_END_B}B"
parted --script "$disk" set "$efi_part_num" esp on
@@ -498,7 +683,6 @@ run_partition_install() {
sleep 1
done
local root_mapper
if [[ "$encrypt_installation" == "true" ]]; then
step "Setting up LUKS2 on $root_partition_device"
printf "%s" "$password" | cryptsetup luksFormat --type luks2 --batch-mode "$root_partition_device" -
@@ -568,6 +752,16 @@ $credentials_encryption_line
}
_EOF_
local luks_uuid_json="null" luks_uuid
if [[ "$encrypt_installation" == "true" ]]; then
if $dry; then
luks_uuid="00000000-0000-0000-0000-000000000000"
else
luks_uuid=$(blkid -s UUID -o value "$root_partition_device")
fi
luks_uuid_json="\"$luks_uuid\""
fi
cat <<-_EOF_ >user_configuration.json
{
"app_config": null,
@@ -576,6 +770,23 @@ _EOF_
"audio_config": { "audio": "pipewire" },
"bootloader_config": { "bootloader": "Limine", "uki": false, "removable": false },
"custom_commands": [],
"omarchy_install": {
"mode": "protected",
"target_mount": "/mnt",
"boot": {
"esp_mount": "$esp_mount_in_target",
"esp_path": "/EFI/limine",
"efi_binary": "limine_x64.efi",
"enable_fallback": false
},
"storage": {
"esp_device": "$efi_dev",
"root_device": "$root_partition_device",
"root_mapper": "$root_mapper",
"luks_uuid": $luks_uuid_json,
"kernel": "$kernel_choice"
}
},
"disk_config": {
"config_type": "pre_mounted_config",
"mountpoint": "/mnt"
@@ -608,8 +819,7 @@ _EOF_
"base-devel",
"git",
"omarchy-keyring",
"omarchy",
"omarchy-installer"
"omarchy"
],
"profile_config": {
"gfx_driver": null,
@@ -620,27 +830,6 @@ _EOF_
}
_EOF_
local luks_uuid_json="null" luks_uuid
if [[ "$encrypt_installation" == "true" ]]; then
if $dry; then
luks_uuid="00000000-0000-0000-0000-000000000000"
else
luks_uuid=$(blkid -s UUID -o value "$root_partition_device")
fi
luks_uuid_json="\"$luks_uuid\""
fi
cat >/root/protected_install.json <<JSON
{
"esp_device": "$efi_dev",
"esp_mount": "$esp_mount_in_target",
"esp_path": "/EFI/limine",
"luks_uuid": $luks_uuid_json,
"root_device": "$root_partition_device",
"kernel": "$kernel_choice"
}
JSON
if $dry; then
echo -e "User Configuration:"
cat user_configuration.json
@@ -652,9 +841,7 @@ JSON
cat user_email_address.txt
echo -e "\nDisk Encryption:"
cat user_encrypt_installation.txt
echo -e "\nProtected Install Intent:"
cat /root/protected_install.json
rm -f user_configuration.json user_credentials.json user_full_name.txt user_email_address.txt user_encrypt_installation.txt /root/protected_install.json
rm -f user_configuration.json user_credentials.json user_full_name.txt user_email_address.txt user_encrypt_installation.txt
fi
}
@@ -709,11 +896,17 @@ open_partition_tool() {
}
install_mode_form() {
local choices=("Full disk install")
# The free-space/protected path registers an EFI boot entry and is UEFI-only.
# Full-disk installs still support BIOS through the orchestrator's BIOS branch.
if [[ -d /sys/firmware/efi ]]; then
choices+=("Free space install (alongside existing data)")
fi
choices+=("Choose a different disk")
step "Installation mode"
install_mode=$(gum choose --header "How should Omarchy be installed on $disk?" \
"Full disk install" \
"Free space install (alongside existing data)" \
"Open partition tool") || abort
install_mode=$(gum choose --header "How should Omarchy be installed on $disk?" "${choices[@]}") || abort
}
while true; do
@@ -728,8 +921,8 @@ while true; do
exit 0
fi
;;
"Open partition tool")
open_partition_tool
"Choose a different disk")
disk_form
;;
esac
done
@@ -855,6 +1048,19 @@ cat <<-_EOF_ >user_configuration.json
"audio_config": { "audio": "pipewire" },
"bootloader_config": { "bootloader": "Limine", "uki": false, "removable": false },
"custom_commands": [],
"omarchy_install": {
"mode": "full_disk",
"target_mount": "/mnt",
"boot": {
"esp_mount": "/boot",
"esp_path": "/EFI/limine",
"efi_binary": "limine_x64.efi",
"enable_fallback": true
},
"storage": {
"kernel": "$kernel_choice"
}
},
"disk_config": {
"btrfs_options": {
"snapshot_config": {
@@ -946,8 +1152,7 @@ cat <<-_EOF_ >user_configuration.json
"base-devel",
"git",
"omarchy-keyring",
"omarchy",
"omarchy-installer"
"omarchy"
],
"profile_config": {
"gfx_driver": null,
@@ -201,6 +201,9 @@ weights = [
('Installing base system', 8, 84, 85),
('Configuring protected boot', 84, 86, 8),
('Configuring hibernation', 86, 88, 5),
('Configuring system', 88, 93, 10),
('Finalizing Limine boot', 93, 96, 8),
('Finalizing user', 96, 98, 10),
('Finalizing in chroot', 88, 98, 10),
('Configuring login', 98, 99, 3),
('Validating protected boot setup', 99, 100, 5),
@@ -66,7 +66,7 @@ def load_arch_config(config_path: Path, creds_path: Path) -> ArchConfigHandler:
import sys
saved_argv = sys.argv
sys.argv = [
saved_argv[0] if saved_argv else "omarchy-install",
saved_argv[0] if saved_argv else "omarchy-iso-install",
"--config", str(config_path),
"--creds", str(creds_path),
]
@@ -21,6 +21,8 @@ class InstallContext:
user_configuration: dict
user_credentials: dict
arch_config_path: Path
omarchy_install: dict[str, Any]
target: Path = Path("/mnt")
omarchy_path: Path = Path("/usr/share/omarchy")
@@ -42,6 +44,15 @@ class InstallContext:
config_path = Path(config_str)
creds_path = Path(creds_str)
user_configuration = json.loads(config_path.read_text())
omarchy_install = user_configuration.get("omarchy_install") or _default_omarchy_install(user_configuration)
arch_configuration = dict(user_configuration)
arch_configuration.pop("omarchy_install", None)
state_dir = Path(os.environ.get("OMARCHY_INSTALL_STATE_DIR", "/run/omarchy-install"))
state_dir.mkdir(parents=True, exist_ok=True)
arch_config_path = state_dir / "archinstall-user_configuration.json"
arch_config_path.write_text(json.dumps(arch_configuration, indent=2) + "\n")
ctx = cls(
config_path=config_path,
creds_path=creds_path,
@@ -50,13 +61,14 @@ class InstallContext:
encrypt=_read_text(os.environ.get("OMARCHY_INSTALL_ENCRYPT_FILE")).lower() in ("true", "yes", "1"),
user_configuration=user_configuration,
user_credentials=json.loads(creds_path.read_text()),
arch_config_path=arch_config_path,
omarchy_install=omarchy_install,
state_dir=state_dir,
)
disk_config = user_configuration.get("disk_config", {})
if (
disk_config.get("config_type") == "pre_mounted_config"
and disk_config.get("mountpoint")
):
ctx.target = Path(disk_config["mountpoint"])
target_mount = omarchy_install.get("target_mount") or disk_config.get("mountpoint")
if target_mount:
ctx.target = Path(target_mount)
return ctx
@property
@@ -65,6 +77,8 @@ class InstallContext:
@property
def mode(self) -> str:
if mode := self.omarchy_install.get("mode"):
return mode
cfg_type = self.user_configuration.get("disk_config", {}).get("config_type")
return "protected" if cfg_type == "pre_mounted_config" else "full_disk"
@@ -73,6 +87,22 @@ class InstallContext:
return self.mode == "protected"
def _default_omarchy_install(user_configuration: dict) -> dict[str, Any]:
disk_config = user_configuration.get("disk_config", {})
mode = "protected" if disk_config.get("config_type") == "pre_mounted_config" else "full_disk"
return {
"mode": mode,
"target_mount": disk_config.get("mountpoint") or "/mnt",
"boot": {
"esp_mount": "/boot",
"esp_path": "/EFI/limine",
"efi_binary": "limine_x64.efi",
"enable_fallback": mode == "full_disk",
},
"storage": {},
}
def _read_text(path: str | None) -> str:
if not path:
return ""
@@ -23,43 +23,33 @@ def build_phases(ctx: InstallContext):
hooks (limine-mkinitcpio-hook, in particular) and useradd happen at
points where their prerequisites are guaranteed to be in place.
Two modes:
- full_disk: archinstall owns disk layout + bootloader.
- protected: Omarchy owns disk layout + bootloader; archinstall is
used for pacstrap + users + packages only.
Full-disk and protected installs use the same phase sequence. The
configurator only changes the JSON input: full-disk asks archinstall to
create/mount the layout, while protected provides an already-mounted target
and the partition details Omarchy needs for boot/fstab generation.
"""
from .phases_impl import (
prepare_live,
arch_install_full,
arch_install_base,
verify_protected_mounts,
configure_protected_boot,
prepare_install_target,
arch_install_system,
configure_hibernation,
run_system_finalizer,
finalize_limine_boot,
run_chroot_finalizer,
configure_login,
validate_boot_full,
validate_boot_protected,
validate_boot,
)
if ctx.is_protected:
return [
("Preparing live environment", prepare_live),
("Verifying protected mounts", verify_protected_mounts),
("Installing base system", arch_install_base),
("Configuring protected boot", configure_protected_boot),
("Configuring hibernation", configure_hibernation),
("Finalizing in chroot", run_chroot_finalizer),
("Configuring login", configure_login),
("Validating protected boot setup", validate_boot_protected),
]
return [
("Preparing live environment", prepare_live),
("Installing Arch + Omarchy", arch_install_full),
("Preparing install target", prepare_install_target),
("Installing Arch + Omarchy", arch_install_system),
("Configuring hibernation", configure_hibernation),
("Finalizing in chroot", run_chroot_finalizer),
("Configuring system", run_system_finalizer),
("Finalizing Limine boot", finalize_limine_boot),
("Finalizing user", run_chroot_finalizer),
("Configuring login", configure_login),
("Validating boot setup", validate_boot_full),
("Validating boot setup", validate_boot),
]
File diff suppressed because it is too large. Load diff