Make install.sh mode-aware with OMARCHY_INSTALL_MODE

Three modes the installer now branches on:

  iso-chroot      Running inside the new system's chroot from the ISO build.
                  pacman is configured by archinstall; systemd isn't running,
                  so service enables skip --now.
  online-package  Running on an existing Arch where the omarchy-* packages
                  are already installed. Skip base.sh and the bootstrap
                  preflight steps; only the per-host runtime ops in
                  config/login/post-install need to run.
  online-git      boot.sh path: clone into $HOME/.local/share/omarchy and
                  bootstrap everything from scratch.

install.sh derives OMARCHY_PATH from its own location, so the same script
works whether it's at /usr/share/omarchy/install.sh (package mode) or
$HOME/.local/share/omarchy/install.sh (git mode). install_mode_is helper
replaces direct ${OMARCHY_CHROOT_INSTALL:-} / ${OMARCHY_ONLINE_INSTALL:-}
checks in chroot.sh, finished.sh, errors.sh, mise-work.sh, preflight/pacman.sh.

Legacy vars still work through export_legacy_mode_flags, which sets
OMARCHY_CHROOT_INSTALL=1 / OMARCHY_ONLINE_INSTALL=true based on the
canonical mode for any caller that hasn't been updated.

bin/omarchy-install-mode prints the current mode for scripts/users that
need to introspect.

Smoke-tested all four entry paths (explicit mode, both legacy shims,
auto-detection from OMARCHY_PATH); each resolves correctly and the
legacy flags are exported in matching modes.
This commit is contained in:
Ryan Hughes
2026-06-04 18:34:35 -04:00
parent 6e0079a66d
commit 6f74091fb6
12 changed files with 89 additions and 16 deletions
+1
View File
@@ -1,3 +1,4 @@
source $OMARCHY_INSTALL/helpers/mode.sh
source $OMARCHY_INSTALL/helpers/chroot.sh
source $OMARCHY_INSTALL/helpers/presentation.sh
source $OMARCHY_INSTALL/helpers/errors.sh
+2 -2
View File
@@ -1,6 +1,6 @@
# Starting the installer with OMARCHY_CHROOT_INSTALL=1 will put it into chroot mode
# In iso-chroot mode systemd isn't running, so skip --now and just enable.
chrootable_systemctl_enable() {
if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then
if install_mode_is iso-chroot; then
sudo systemctl enable $1
else
sudo systemctl enable --now $1
+2 -2
View File
@@ -104,8 +104,8 @@ catch_errors() {
while true; do
options=()
# If online install, show retry first
if [[ -n ${OMARCHY_ONLINE_INSTALL:-} ]]; then
# Retry only makes sense for online flows (git clone or package install).
if install_mode_is online-git || install_mode_is online-package; then
options+=("Retry installation")
fi
+38
View File
@@ -0,0 +1,38 @@
# OMARCHY_INSTALL_MODE is one of: iso-chroot, online-package, online-git
# Back-compat shims honor the older OMARCHY_CHROOT_INSTALL and
# OMARCHY_ONLINE_INSTALL flags during transition.
detect_install_mode() {
if [[ -n ${OMARCHY_INSTALL_MODE:-} ]]; then
return
fi
if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then
export OMARCHY_INSTALL_MODE=iso-chroot
elif [[ -n ${OMARCHY_ONLINE_INSTALL:-} ]]; then
export OMARCHY_INSTALL_MODE=online-git
elif [[ ${OMARCHY_PATH:-} == /usr/share/omarchy ]]; then
export OMARCHY_INSTALL_MODE=online-package
else
export OMARCHY_INSTALL_MODE=online-git
fi
}
install_mode_is() {
[[ ${OMARCHY_INSTALL_MODE:-} == "$1" ]]
}
# Sets OMARCHY_CHROOT_INSTALL=1 and OMARCHY_ONLINE_INSTALL=true so callers
# that still check the legacy vars keep working through the transition.
export_legacy_mode_flags() {
case ${OMARCHY_INSTALL_MODE:-} in
iso-chroot)
export OMARCHY_CHROOT_INSTALL=1
;;
online-git)
export OMARCHY_ONLINE_INSTALL=true
;;
esac
}
export -f install_mode_is