Make setup ISO-only

Remove legacy online installer entrypoints, collapse migrations for 4.0, and move setup responsibilities into target-side system, hardware, and user commands.
This commit is contained in:
Ryan Hughes
2026-06-04 18:37:32 -04:00
parent b45e8464ef
commit 75cb4f7195
440 changed files with 790 additions and 4922 deletions
-5
View File
@@ -1,5 +0,0 @@
source $OMARCHY_INSTALL/helpers/mode.sh
source $OMARCHY_INSTALL/helpers/chroot.sh
source $OMARCHY_INSTALL/helpers/presentation.sh
source $OMARCHY_INSTALL/helpers/errors.sh
source $OMARCHY_INSTALL/helpers/logging.sh
-179
View File
@@ -1,179 +0,0 @@
# Directs user to Omarchy Discord
QR_CODE='
█▀▀▀▀▀█ ▄ ▄ ▀▄▄▄█ █▀▀▀▀▀█
█ ███ █ ▄▄▄▄▀▄▀▄▀ █ ███ █
█ ▀▀▀ █ ▄█ ▄█▄▄▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀▄█ █ █ █ ▀▀▀▀▀▀▀
▀▀█▀▀▄▀▀▀▀▄█▀▀█ ▀ █ ▀ █
█▄█ ▄▄▀▄▄ ▀ ▄ ▀█▄▄▄▄ ▀ ▀█
▄ ▄▀█ ▀▄▀▀▀▄ ▄█▀▄█▀▄▀▄▀█▀
█ ▄▄█▄▀▄█ ▄▄▄ ▀ ▄▀██▀ ▀█
▀ ▀ ▀ █ ▀▄ ▀▀█▀▀▀█▄▀
█▀▀▀▀▀█ ▀█ ▄▀▀ █ ▀ █▄▀██
█ ███ █ █▀▄▄▀ █▀███▀█▄██▄
█ ▀▀▀ █ ██ ▀ █▄█ ▄▄▄█▀ █
▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀ ▀ ▀▀▀▀▀▀'
# Track if we're already handling an error to prevent double-trapping
ERROR_HANDLING=false
# Cursor is usually hidden while we install
show_cursor() {
printf "\033[?25h"
}
# Display truncated log lines from the install log
show_log_tail() {
if [[ -f $OMARCHY_INSTALL_LOG_FILE ]]; then
local log_lines=$((TERM_HEIGHT - LOGO_HEIGHT - 35))
local max_line_width=$((LOGO_WIDTH - 4))
tail -n $log_lines "$OMARCHY_INSTALL_LOG_FILE" | while IFS= read -r line; do
if ((${#line} > max_line_width)); then
local truncated_line="${line:0:$max_line_width}..."
else
local truncated_line="$line"
fi
gum style "$truncated_line"
done
echo
fi
}
# Display the failed command or script name
show_failed_script_or_command() {
if [[ -n ${CURRENT_SCRIPT:-} ]]; then
gum style "Failed script: $CURRENT_SCRIPT"
else
# Truncate long command lines to fit the display
local cmd="$BASH_COMMAND"
local max_cmd_width=$((LOGO_WIDTH - 4))
if ((${#cmd} > max_cmd_width)); then
cmd="${cmd:0:$max_cmd_width}..."
fi
gum style "$cmd"
fi
}
# Save original stdout and stderr for trap to use
save_original_outputs() {
exec 3>&1 4>&2
}
# Restore stdout and stderr to original (saved in FD 3 and 4)
# This ensures output goes to screen, not log file
restore_outputs() {
if [[ -e /proc/self/fd/3 ]] && [[ -e /proc/self/fd/4 ]]; then
exec 1>&3 2>&4
fi
}
# Error handler
catch_errors() {
# Store exit code before any conditionals or assignments overwrite $?. EXIT
# trap callers pass their already-preserved code because calling this function
# would otherwise reset $? before we can read it.
local exit_code="${1:-$?}"
# Prevent recursive error handling
if [[ $ERROR_HANDLING == "true" ]]; then
return
else
ERROR_HANDLING=true
fi
stop_log_output
if [[ -n ${OMARCHY_CHROOT_FINALIZER:-} ]]; then
{
echo "Omarchy installation stopped inside offline finalizer."
echo "This command halted with exit code $exit_code:"
if [[ -n ${CURRENT_SCRIPT:-} ]]; then
echo "Failed script: $CURRENT_SCRIPT"
else
echo "$BASH_COMMAND"
fi
echo "The live ISO orchestrator will show the visible error screen."
} >&2
exit "$exit_code"
fi
restore_outputs
clear_logo
show_cursor
gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "Omarchy installation stopped!"
show_log_tail
gum style "This command halted with exit code $exit_code:"
show_failed_script_or_command
gum style "$QR_CODE"
echo
gum style "Get help from the community via QR code or at https://discord.gg/tXFUdasqhY"
# Offer options menu
while true; do
options=()
if install_mode_is online; then
options+=("Retry installation")
fi
# Add upload option if internet is available
if ping -c 1 -W 1 1.1.1.1 >/dev/null 2>&1; then
options+=("Upload log for support")
fi
# Add remaining options
options+=("View full log")
options+=("Exit")
choice=$(gum choose "${options[@]}" --header "What would you like to do?" --height 6 --padding "1 $PADDING_LEFT")
case "$choice" in
"Retry installation")
OMARCHY_INSTALL_MODE="$OMARCHY_INSTALL_MODE" bash "$OMARCHY_PATH/install.sh"
break
;;
"View full log")
if command -v less &>/dev/null; then
less "$OMARCHY_INSTALL_LOG_FILE"
else
tail "$OMARCHY_INSTALL_LOG_FILE"
fi
;;
"Upload log for support")
omarchy-upload-log
;;
"Exit" | "")
exit "$exit_code"
;;
esac
done
}
# Exit handler - ensures cleanup happens on any exit
exit_handler() {
local exit_code=$?
# Only run if we're exiting with an error and haven't already handled it
if (( exit_code != 0 )) && [[ $ERROR_HANDLING != "true" ]]; then
catch_errors "$exit_code"
else
stop_log_output
[[ -n ${OMARCHY_CHROOT_FINALIZER:-} ]] || show_cursor
fi
}
# Set up traps
trap catch_errors ERR INT TERM
trap exit_handler EXIT
# Save original outputs in case we trap
save_original_outputs
+20 -120
View File
@@ -1,139 +1,41 @@
start_log_output() {
# Offline ISO installs already have a live dashboard on tty1. The chrooted
# finalizer's stdout/stderr is captured to logs, so this monitor would only
# create noisy feedback in the log and burn CPU.
[[ -n ${OMARCHY_CHROOT_FINALIZER:-} ]] && return 0
local ANSI_SAVE_CURSOR="\033[s"
local ANSI_RESTORE_CURSOR="\033[u"
local ANSI_CLEAR_LINE="\033[2K"
local ANSI_HIDE_CURSOR="\033[?25l"
local ANSI_RESET="\033[0m"
local ANSI_GRAY="\033[90m"
# Save cursor position and hide cursor
printf $ANSI_SAVE_CURSOR
printf $ANSI_HIDE_CURSOR
(
local log_lines=20
local max_line_width=$((LOGO_WIDTH - 4))
while true; do
# Read the last N lines into an array
mapfile -t current_lines < <(tail -n $log_lines "$OMARCHY_INSTALL_LOG_FILE" 2>/dev/null)
# Build complete output buffer with escape sequences
output=""
for ((i = 0; i < log_lines; i++)); do
line="${current_lines[i]:-}"
# Truncate if needed
if (( ${#line} > max_line_width )); then
line="${line:0:$max_line_width}..."
fi
# Add clear line escape and formatted output for each line
if [[ -n $line ]]; then
output+="${ANSI_CLEAR_LINE}${ANSI_GRAY}${PADDING_LEFT_SPACES}${line}${ANSI_RESET}\n"
else
output+="${ANSI_CLEAR_LINE}${PADDING_LEFT_SPACES}\n"
fi
done
printf "${ANSI_RESTORE_CURSOR}%b" "$output"
sleep 0.1
done
) &
monitor_pid=$!
}
stop_log_output() {
if [[ -n ${monitor_pid:-} ]]; then
kill $monitor_pid 2>/dev/null || true
wait $monitor_pid 2>/dev/null || true
unset monitor_pid
fi
}
start_install_log() {
sudo touch "$OMARCHY_INSTALL_LOG_FILE"
sudo chmod 666 "$OMARCHY_INSTALL_LOG_FILE"
mkdir -p "$(dirname "$OMARCHY_INSTALL_LOG_FILE")"
touch "$OMARCHY_INSTALL_LOG_FILE"
chmod 666 "$OMARCHY_INSTALL_LOG_FILE" 2>/dev/null || true
export OMARCHY_START_TIME=$(date '+%Y-%m-%d %H:%M:%S')
export OMARCHY_START_EPOCH=$(date +%s)
export OMARCHY_START_TIME="${OMARCHY_START_TIME:-$(date '+%Y-%m-%d %H:%M:%S')}"
export OMARCHY_START_EPOCH="${OMARCHY_START_EPOCH:-$(date +%s)}"
echo "=== Omarchy Installation Started: $OMARCHY_START_TIME ===" >>"$OMARCHY_INSTALL_LOG_FILE"
start_log_output
echo "=== Omarchy Setup Started: $OMARCHY_START_TIME ===" >>"$OMARCHY_INSTALL_LOG_FILE"
}
stop_install_log() {
stop_log_output
[[ -n ${OMARCHY_CHROOT_FINALIZER:-} ]] || show_cursor
[[ -n ${OMARCHY_INSTALL_LOG_FILE:-} ]] || return 0
if [[ -n ${OMARCHY_INSTALL_LOG_FILE:-} ]]; then
OMARCHY_END_TIME=$(date '+%Y-%m-%d %H:%M:%S')
OMARCHY_END_EPOCH=$(date +%s)
echo "=== Omarchy Installation Completed: $OMARCHY_END_TIME ===" >>"$OMARCHY_INSTALL_LOG_FILE"
echo "" >>"$OMARCHY_INSTALL_LOG_FILE"
echo "=== Installation Time Summary ===" >>"$OMARCHY_INSTALL_LOG_FILE"
local end_time end_epoch duration mins secs
end_time=$(date '+%Y-%m-%d %H:%M:%S')
end_epoch=$(date +%s)
if [[ -f "/var/log/archinstall/install.log" ]]; then
ARCHINSTALL_START=$(grep -m1 '^\[' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true)
ARCHINSTALL_END=$(grep 'Installation completed without any errors' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true)
echo "=== Omarchy Setup Completed: $end_time ===" >>"$OMARCHY_INSTALL_LOG_FILE"
if [[ -n $ARCHINSTALL_START ]] && [[ -n $ARCHINSTALL_END ]]; then
ARCH_START_EPOCH=$(date -d "$ARCHINSTALL_START" +%s)
ARCH_END_EPOCH=$(date -d "$ARCHINSTALL_END" +%s)
ARCH_DURATION=$((ARCH_END_EPOCH - ARCH_START_EPOCH))
ARCH_MINS=$((ARCH_DURATION / 60))
ARCH_SECS=$((ARCH_DURATION % 60))
echo "Archinstall: ${ARCH_MINS}m ${ARCH_SECS}s" >>"$OMARCHY_INSTALL_LOG_FILE"
fi
fi
if [[ -z ${OMARCHY_START_TIME:-} ]] && [[ -f "$OMARCHY_INSTALL_LOG_FILE" ]]; then
OMARCHY_START_TIME=$(grep -m1 '^=== Omarchy Installation Started:' "$OMARCHY_INSTALL_LOG_FILE" 2>/dev/null |
sed 's/^=== Omarchy Installation Started: \(.*\) ===$/\1/' || true)
fi
if [[ -z ${OMARCHY_START_EPOCH:-} && -n ${OMARCHY_START_TIME:-} ]]; then
OMARCHY_START_EPOCH=$(date -d "$OMARCHY_START_TIME" +%s)
fi
if [[ -n ${OMARCHY_START_EPOCH:-} ]]; then
OMARCHY_DURATION=$((OMARCHY_END_EPOCH - OMARCHY_START_EPOCH))
OMARCHY_MINS=$((OMARCHY_DURATION / 60))
OMARCHY_SECS=$((OMARCHY_DURATION % 60))
echo "Omarchy: ${OMARCHY_MINS}m ${OMARCHY_SECS}s" >>"$OMARCHY_INSTALL_LOG_FILE"
if [[ -n ${ARCH_DURATION:-} ]]; then
TOTAL_DURATION=$((ARCH_DURATION + OMARCHY_DURATION))
TOTAL_MINS=$((TOTAL_DURATION / 60))
TOTAL_SECS=$((TOTAL_DURATION % 60))
echo "Total: ${TOTAL_MINS}m ${TOTAL_SECS}s" >>"$OMARCHY_INSTALL_LOG_FILE"
fi
fi
echo "=================================" >>"$OMARCHY_INSTALL_LOG_FILE"
echo "Rebooting system..." >>"$OMARCHY_INSTALL_LOG_FILE"
if [[ -n ${OMARCHY_START_EPOCH:-} ]]; then
duration=$((end_epoch - OMARCHY_START_EPOCH))
mins=$((duration / 60))
secs=$((duration % 60))
echo "Omarchy setup: ${mins}m ${secs}s" >>"$OMARCHY_INSTALL_LOG_FILE"
fi
}
run_logged() {
local script="$1"
export CURRENT_SCRIPT="$script"
if [[ -z ${OMARCHY_INSTALL_LOG_FILE:-} ]]; then
bash -eE -c 'source "$1"' bash "$script"
return
fi
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script" >>"$OMARCHY_INSTALL_LOG_FILE"
# Use a clean subshell, but keep errexit so failures inside sourced scripts
# cannot be hidden by a later successful command in the same script.
if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \
bash -x -eE -c 'source "$1"' bash "$script" </dev/null >>"$OMARCHY_INSTALL_LOG_FILE" 2>&1
@@ -142,10 +44,8 @@ run_logged() {
fi
local exit_code=$?
if (( exit_code == 0 )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Completed: $script" >>"$OMARCHY_INSTALL_LOG_FILE"
unset CURRENT_SCRIPT
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Failed: $script (exit code: $exit_code)" >>"$OMARCHY_INSTALL_LOG_FILE"
fi
-51
View File
@@ -1,51 +0,0 @@
# OMARCHY_INSTALL_MODE is one of: online, offline
# online - bootstrap installed omarchy-* packages from the omacom-pkgs.org
# repo on an existing Arch system, then ran install.sh.
# offline - ISO build: archinstall pacstrapped the bundled mirror; install.sh
# runs in the chroot before the user's first boot.
# Legacy OMARCHY_CHROOT_INSTALL and OMARCHY_ONLINE_INSTALL still work as
# shims during transition.
detect_install_mode() {
if [[ -n ${OMARCHY_INSTALL_MODE:-} ]]; then
case $OMARCHY_INSTALL_MODE in
online|offline) ;;
*)
echo "Error: invalid OMARCHY_INSTALL_MODE=$OMARCHY_INSTALL_MODE" >&2
echo " must be one of: online, offline" >&2
exit 1
;;
esac
export OMARCHY_INSTALL_MODE
return
fi
if [[ -n ${OMARCHY_CHROOT_INSTALL:-} ]]; then
export OMARCHY_INSTALL_MODE=offline
elif [[ -n ${OMARCHY_ONLINE_INSTALL:-} ]]; then
export OMARCHY_INSTALL_MODE=online
else
export OMARCHY_INSTALL_MODE=online
fi
}
install_mode_is() {
[[ ${OMARCHY_INSTALL_MODE:-} == "$1" ]]
}
# Synchronize the legacy vars to the canonical mode so callers that still
# check OMARCHY_CHROOT_INSTALL / OMARCHY_ONLINE_INSTALL agree with us.
export_legacy_mode_flags() {
case ${OMARCHY_INSTALL_MODE:-} in
offline)
export OMARCHY_CHROOT_INSTALL=1
unset OMARCHY_ONLINE_INSTALL
;;
online)
export OMARCHY_ONLINE_INSTALL=true
unset OMARCHY_CHROOT_INSTALL
;;
esac
}
export -f install_mode_is
-48
View File
@@ -1,48 +0,0 @@
# Ensure we have gum available
if ! command -v gum &>/dev/null; then
omarchy-pkg-add gum
fi
# Get terminal size from /dev/tty (works in all scenarios: direct, sourced, or piped)
if [[ -e /dev/tty ]]; then
TERM_SIZE=$(stty size 2>/dev/null </dev/tty || true)
if [[ -n $TERM_SIZE ]]; then
export TERM_HEIGHT=$(echo "$TERM_SIZE" | cut -d' ' -f1)
export TERM_WIDTH=$(echo "$TERM_SIZE" | cut -d' ' -f2)
else
# Fallback to reasonable defaults if stty fails
export TERM_WIDTH=80
export TERM_HEIGHT=24
fi
else
# No terminal available (e.g., non-interactive environment)
export TERM_WIDTH=80
export TERM_HEIGHT=24
fi
export LOGO_PATH="$OMARCHY_PATH/logo.txt"
export LOGO_WIDTH=$(awk '{ if (length > max) max = length } END { print max+0 }' "$LOGO_PATH" 2>/dev/null || echo 0)
export LOGO_HEIGHT=$(wc -l <"$LOGO_PATH" 2>/dev/null || echo 0)
export PADDING_LEFT=$(((TERM_WIDTH - LOGO_WIDTH) / 2))
export PADDING_LEFT_SPACES=$(printf "%*s" $PADDING_LEFT "")
# Tokyo Night theme for gum confirm
export GUM_CONFIRM_PROMPT_FOREGROUND="6" # Cyan for prompt
export GUM_CONFIRM_SELECTED_FOREGROUND="0" # Black text on selected
export GUM_CONFIRM_SELECTED_BACKGROUND="2" # Green background for selected
export GUM_CONFIRM_UNSELECTED_FOREGROUND="7" # White for unselected
export GUM_CONFIRM_UNSELECTED_BACKGROUND="0" # Black background for unselected
export PADDING="0 0 0 $PADDING_LEFT" # Gum Style
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" # Clear screen and move cursor to top-left
gum style --foreground 2 --padding "1 0 0 $PADDING_LEFT" "$(<"$LOGO_PATH")"
}