mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 04:29:34 +02:00
Drop online-git: the new world has a single package-backed install path that's either online (pacman pulls from omacom-pkgs.org) or offline (ISO chroot pulls from the bundled mirror). The git-clone-and-run-installer path is gone — boot.sh becomes a thin bootstrap that installs the omarchy-installer package and invokes its installer. - install/helpers/mode.sh: two modes, validation message updated. Default fallback is 'online' (the boot.sh path); OMARCHY_CHROOT_INSTALL=1 still shims to offline, OMARCHY_ONLINE_INSTALL=true still shims to online. - install/preflight/all.sh: first-run-mode + disable-mkinitcpio gated on offline (offline is the from-scratch chroot path; online runs on an existing system). - install/preflight/pacman.sh: DELETED. boot.sh now handles repo config before install.sh runs. - install/packaging/all.sh: drop base.sh entirely. Both modes have base packages installed via omarchy-installer's depends before install.sh runs. base.sh remains on disk in case the ISO mirror build flow wants to invoke it directly. - install/helpers/chroot.sh, errors.sh, post-install/finished.sh, config/mise-work.sh: rename mode checks to use online/offline.
163 lines
4.2 KiB
Bash
163 lines
4.2 KiB
Bash
# 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() {
|
|
# Prevent recursive error handling
|
|
if [[ $ERROR_HANDLING == "true" ]]; then
|
|
return
|
|
else
|
|
ERROR_HANDLING=true
|
|
fi
|
|
|
|
# Store exit code immediately before it gets overwritten
|
|
local exit_code=$?
|
|
|
|
stop_log_output
|
|
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 1
|
|
;;
|
|
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
|
|
else
|
|
stop_log_output
|
|
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
|