From 81e81fe0c88a3e7b18641067c54810d01aeff442 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Wed, 20 May 2026 20:08:14 -0400 Subject: [PATCH] Address momus review of OMARCHY_INSTALL_MODE work - install.sh: use realpath to follow symlinks when deriving OMARCHY_PATH from script location. Logical pwd left dev-link symlink chains pointing at the wrong dir; realpath resolves to the underlying checkout. - install/helpers/mode.sh: validate explicit OMARCHY_INSTALL_MODE values and exit on typos. Also export_legacy_mode_flags now UNSETS the contradictory legacy flag for each mode so unmigrated callers can't see both OMARCHY_CHROOT_INSTALL=1 and OMARCHY_ONLINE_INSTALL=true. - install/helpers/errors.sh: retry uses "$OMARCHY_PATH/install.sh" and preserves OMARCHY_INSTALL_MODE explicitly; the previous hardcoded ~/.local/share/omarchy/install.sh broke package-mode retries. - bin/omarchy-install-mode: soften the summary; the helper only knows the current env, not any persisted post-install state. --- bin/omarchy-install-mode | 9 +++------ install.sh | 2 +- install/helpers/errors.sh | 2 +- install/helpers/mode.sh | 20 ++++++++++++++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bin/omarchy-install-mode b/bin/omarchy-install-mode index bff86aa3..e3a4fb48 100755 --- a/bin/omarchy-install-mode +++ b/bin/omarchy-install-mode @@ -1,11 +1,8 @@ #!/bin/bash -# omarchy:summary=Print the install mode the installer was last invoked with +# omarchy:summary=Print the OMARCHY_INSTALL_MODE in the current env # omarchy:group=install -# Used by scripts that need to branch on whether Omarchy was bootstrapped -# via ISO (iso-chroot), pacman install (online-package), or boot.sh -# (online-git). The current install.sh sets this; persisted state lives in -# /var/lib/omarchy/install-mode if Chunk 6+ chooses to record it. For now -# we echo whatever is in the current env. +# install.sh exports this during the install flow. Not persisted post-install, +# so this prints 'unknown' outside the installer. echo "${OMARCHY_INSTALL_MODE:-unknown}" diff --git a/install.sh b/install.sh index 30516250..40e9c59f 100644 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ set -eEo pipefail # 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=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +_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" diff --git a/install/helpers/errors.sh b/install/helpers/errors.sh index 04ab15df..9b560c43 100644 --- a/install/helpers/errors.sh +++ b/install/helpers/errors.sh @@ -122,7 +122,7 @@ catch_errors() { case "$choice" in "Retry installation") - bash ~/.local/share/omarchy/install.sh + OMARCHY_INSTALL_MODE="$OMARCHY_INSTALL_MODE" bash "$OMARCHY_PATH/install.sh" break ;; "View full log") diff --git a/install/helpers/mode.sh b/install/helpers/mode.sh index 0c3502d8..f1c61af0 100644 --- a/install/helpers/mode.sh +++ b/install/helpers/mode.sh @@ -4,6 +4,15 @@ detect_install_mode() { if [[ -n ${OMARCHY_INSTALL_MODE:-} ]]; then + case $OMARCHY_INSTALL_MODE in + iso-chroot|online-package|online-git) ;; + *) + echo "Error: invalid OMARCHY_INSTALL_MODE=$OMARCHY_INSTALL_MODE" >&2 + echo " must be one of: iso-chroot, online-package, online-git" >&2 + exit 1 + ;; + esac + export OMARCHY_INSTALL_MODE return fi @@ -22,15 +31,22 @@ 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. +# Synchronize the legacy vars to the canonical mode so callers that still +# check OMARCHY_CHROOT_INSTALL / OMARCHY_ONLINE_INSTALL agree with us +# (including unsetting contradictory ones). export_legacy_mode_flags() { case ${OMARCHY_INSTALL_MODE:-} in iso-chroot) export OMARCHY_CHROOT_INSTALL=1 + unset OMARCHY_ONLINE_INSTALL ;; online-git) export OMARCHY_ONLINE_INSTALL=true + unset OMARCHY_CHROOT_INSTALL + ;; + online-package) + unset OMARCHY_CHROOT_INSTALL + unset OMARCHY_ONLINE_INSTALL ;; esac }